Skip to content

Commit

Permalink
Merge pull request #135 from ChicagoWorldcon/staging
Browse files Browse the repository at this point in the history
Staging
  • Loading branch information
balen authored May 26, 2022
2 parents be937c9 + 5264418 commit 936b837
Show file tree
Hide file tree
Showing 21 changed files with 2,476 additions and 696 deletions.
152 changes: 152 additions & 0 deletions db/seeds/area.seeds.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
p "Start area seeds"

unless Area.find_by_name('1946 Project')
Area.create!(
name: "1946 Project",
sort_order: 1
)
end

unless Area.find_by_name('Anime')
Area.create!(
name: "Anime",
sort_order: 2
)
end

unless Area.find_by_name('Art')
Area.create!(
name: "Art",
sort_order: 3
)
end

unless Area.find_by_name('Childrens Program')
Area.create!(
name: "Childrens Program",
sort_order: 4
)
end

unless Area.find_by_name('Comics')
Area.create!(
name: "Comics",
sort_order: 5
)
end

unless Area.find_by_name('Costuming & Cosplay')
Area.create!(
name: "Costuming & Cosplay",
sort_order: 6
)
end

unless Area.find_by_name('Events')
Area.create!(
name: "Events",
sort_order: 7
)
end

unless Area.find_by_name('Fandom')
Area.create!(
name: "Fandom",
sort_order: 8
)
end

unless Area.find_by_name('Gaming Program')
Area.create!(
name: "Gaming Program",
sort_order: 9
)
end

unless Area.find_by_name('Literature')
Area.create!(
name: "Literature",
sort_order: 10
)
end

unless Area.find_by_name('Maker')
Area.create!(
name: "Maker",
sort_order: 11
)
end

unless Area.find_by_name('Media')
Area.create!(
name: "Media",
sort_order: 12
)
end

unless Area.find_by_name('Meetups')
Area.create!(
name: "Meetups",
sort_order: 13
)
end

unless Area.find_by_name('Music & Filk')
Area.create!(
name: "Music & Filk",
sort_order: 14
)
end

unless Area.find_by_name('Podcasting')
Area.create!(
name: "Podcasting",
sort_order: 15
)
end

unless Area.find_by_name('Polish SFF')
Area.create!(
name: "Polish SFF",
sort_order: 16
)
end

unless Area.find_by_name('Science & Technology')
Area.create!(
name: "Science & Technology",
sort_order: 17
)
end

unless Area.find_by_name('Society')
Area.create!(
name: "Society",
sort_order: 18
)
end

unless Area.find_by_name('Theater Program')
Area.create!(
name: "Theater Program",
sort_order: 19
)
end

unless Area.find_by_name('Virtual')
Area.create!(
name: "Virtual",
sort_order: 20
)
end

unless Area.find_by_name('Writing')
Area.create!(
name: "Writing",
sort_order: 21
)
end


p "End area seeds"

31 changes: 19 additions & 12 deletions db/seeds/development/agreement.seeds.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
p "Start development agreement seeds"

after "development:person" do

if Agreement.count == 0
if Agreement.count == 0

Agreement::targets.keys.each do |target|
creator = Person.all.sample.id
Agreement.create(
title: Faker::Lorem.sentence,
terms: Faker::Lorem.sentences(number: 3).join('. '),
agreement_type: "test",
description: "This is a description",
target: target,
created_by_id: creator,
updated_by_id: creator
)
end

Agreement::targets.keys.each do |target|
creator = Person.all.sample.id
Agreement.create(
title: Faker::Lorem.sentence,
terms: Faker::Lorem.sentences(number: 3).join('. '),
agreement_type: "test",
description: "This is a description",
target: target,
created_by_id: creator,
updated_by_id: creator
)
end

end


p "End development agreement seeds"
16 changes: 0 additions & 16 deletions db/seeds/development/area.seeds.rb

This file was deleted.

25 changes: 12 additions & 13 deletions db/seeds/development/format.seeds.rb
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
return if Format.count > 0
p "Start development format seeds"

Format.create(
name: 'Panel',
position: 1
)
unless Format.find_by_name('Dev Panel')
Format.create!(
name: 'Dev Panel'
)
end

Format.create(
name: 'Talk',
position: 2
)
unless Format.find_by_name('Dev Talk')
Format.create!(
name: 'Dev Talk'
)
end

Format.create(
name: 'Workshop',
position: 3
)
p "End format seeds"
73 changes: 73 additions & 0 deletions db/seeds/development/person.seeds.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
p "Start development person seeds"

if Person.count < 100
100.times.each do |i|
registered = Faker::Boolean.boolean(true_ratio: 0.5)
registration_number = ''
registration_type = ''

if registered == true
registration_number = i + 1000
registration_type = %w[supporting adult child teen ya first].sample
end

name = Faker::Name.name
username = name.gsub(' ','_')
person = Person.create(
name: name,
name_sort_by: name,
name_sort_by_confirmed: true,
organization: Faker::Company.name,
job_title: Faker::Company.profession,
pronouns: %w[he/him she/her they/them ze/zir].sample,
gender: Faker::Gender.type,
year_of_birth: Faker::Date.between(from: 90.years.ago, to: 1.year.ago).year,
ethnicity: Faker::Demographic.race,
opted_in: Faker::Boolean.boolean(true_ratio: 0.9),
comments: Faker::Books::Dune.quote,
con_state: %w[not_set accepted].sample,
registered: registered,
registration_number: registration_number,
registration_type: registration_type,
bio: Faker::Lorem.sentences(number: 3).join('. '),
pseudonym: username,
website: Faker::Internet.url,
twitter: username,
othersocialmedia: username,
facebook: username,
linkedin: username,
twitch: username,
youtube: username,
instagram: username,
flickr: username,
reddit: username,
tiktok: username
)
e = name.gsub(' ', '_') + i.to_s + '@test.com'
EmailAddress.create(
person: person,
isdefault: true,
email: e,
is_valid: true
)
secondary = Faker::Boolean.boolean(true_ratio: 0.5)
if secondary == true
e = name.gsub(' ', '_') + '_second' + '@test.com'
EmailAddress.create(
person: person,
isdefault: false,
email: e,
is_valid: true
)
end

ConventionRole.create(
person: person,
role: ConventionRole.roles[:participant]
)
end

p "Created #{Person.count} people."
end

p "End development person seeds"
79 changes: 44 additions & 35 deletions db/seeds/development/room.seeds.rb
Original file line number Diff line number Diff line change
@@ -1,38 +1,47 @@
if !Room.find_by(name: 'Room Dimensions')
r = Room.create(
name: 'Room Dimensions',
purpose: "For discussion of " + Faker::Science.science,
comment: Faker::Movie.quote,
sort_order: Faker::Number.unique.number(digits: 3),
capacity: Faker::Number.unique.number(digits: 3),
floor: Faker::Number.between(from: 1, to: 10),
open_for_schedule: true,
is_virtual: false,
length: 400,
width: 893,
height: 102
)
p "Made " + r.name
end
p "Start development room seeds"

after :room_set do

unless Room.find_by(name: 'Room Dimensions')
r = Room.create(
name: 'Room Dimensions',
purpose: "For discussion of " + Faker::Science.science,
comment: Faker::Movie.quote,
sort_order: Faker::Number.unique.number(digits: 3),
capacity: Faker::Number.unique.number(digits: 3),
floor: Faker::Number.between(from: 1, to: 10),
open_for_schedule: true,
is_virtual: false,
length: 400,
width: 893,
height: 102
)
p "Made " + r.name
end


roomset = RoomSet.find_by_name('Panel')


unless Room.find_by(name: 'Room with Room Set')
r = Room.create(
name: 'Room with Room Set',
purpose: "For discussion of " + Faker::Science.science,
comment: Faker::Movie.quote,
sort_order: Faker::Number.unique.number(digits: 3),
capacity: Faker::Number.unique.number(digits: 3),
floor: Faker::Number.between(from: 1, to: 10),
open_for_schedule: true,
is_virtual: false,
length: 2556,
width: 1368,
height: 204,
room_set_id: roomset.id
)
p "Made " + r.name
end

roomset = RoomSet.find_by_name('Panel')
p "Room Set " + roomset.name + ' ' + roomset.id

if !Room.find_by(name: 'Room with Room Set')
r = Room.create(
name: 'Room with Room Set',
purpose: "For discussion of " + Faker::Science.science,
comment: Faker::Movie.quote,
sort_order: Faker::Number.unique.number(digits: 3),
capacity: Faker::Number.unique.number(digits: 3),
floor: Faker::Number.between(from: 1, to: 10),
open_for_schedule: true,
is_virtual: false,
length: 2556,
width: 1368,
height: 204,
room_set_id: roomset.id
)
p "Made " + r.name
end

p "End development room seeds"

Loading

0 comments on commit 936b837

Please sign in to comment.