2024-08-02 18:42:24 +02:00
|
|
|
NUMBER_OF_GUESTS = ENV['SEED_GUEST_COUNT'].presence.to_i || 50
|
2024-07-11 20:00:55 +02:00
|
|
|
|
2024-08-01 18:27:41 +00:00
|
|
|
TablesArrangement.delete_all
|
2024-07-11 20:00:55 +02:00
|
|
|
Expense.delete_all
|
2024-07-11 20:11:04 +02:00
|
|
|
Guest.delete_all
|
2024-07-11 20:41:07 +02:00
|
|
|
ActsAsTaggableOn::Tagging.delete_all
|
|
|
|
ActsAsTaggableOn::Tag.delete_all
|
2024-07-11 20:00:55 +02:00
|
|
|
|
|
|
|
Expense.create!(name: 'Photographer', amount: 3000, pricing_type: 'fixed')
|
|
|
|
Expense.create!(name: 'Country house', amount: 6000, pricing_type: 'fixed')
|
|
|
|
Expense.create!(name: 'Catering', amount: 200, pricing_type: 'per_person')
|
|
|
|
Expense.create!(name: 'Flowers', amount: 500, pricing_type: 'fixed')
|
|
|
|
Expense.create!(name: 'Band', amount: 1000, pricing_type: 'fixed')
|
|
|
|
Expense.create!(name: 'Wedding planner', amount: 2000, pricing_type: 'fixed')
|
|
|
|
Expense.create!(name: 'Dress', amount: 1000, pricing_type: 'fixed')
|
|
|
|
Expense.create!(name: 'Suit', amount: 500, pricing_type: 'fixed')
|
|
|
|
Expense.create!(name: 'Rings', amount: 1000, pricing_type: 'fixed')
|
|
|
|
Expense.create!(name: 'Makeup', amount: 200, pricing_type: 'fixed')
|
|
|
|
Expense.create!(name: 'Hair', amount: 200, pricing_type: 'fixed')
|
|
|
|
Expense.create!(name: 'Transportation', amount: 3000, pricing_type: 'fixed')
|
|
|
|
Expense.create!(name: 'Invitations', amount: 200, pricing_type: 'fixed')
|
|
|
|
Expense.create!(name: 'Cake', amount: 500, pricing_type: 'fixed')
|
2024-07-11 20:11:04 +02:00
|
|
|
|
2024-07-11 23:25:29 +02:00
|
|
|
samples = {
|
2024-07-31 20:58:47 +02:00
|
|
|
close_family_a: 10,
|
|
|
|
close_family_b: 10,
|
|
|
|
cousins_a: 20,
|
|
|
|
cousins_b: 15,
|
|
|
|
relatives_a: 15,
|
|
|
|
relatives_b: 10,
|
|
|
|
work_a: 10,
|
|
|
|
work_b: 10,
|
|
|
|
besties_work_a: 5,
|
|
|
|
besties_work_b: 5,
|
|
|
|
college_friends_a: 10,
|
|
|
|
college_friends_b: 10,
|
|
|
|
high_school_friends_a: 10,
|
|
|
|
high_school_friends_b: 10,
|
|
|
|
childhood_friends_a: 10,
|
|
|
|
childhood_friends_b: 10,
|
|
|
|
basket_team_a: 10,
|
|
|
|
football_team_a: 15,
|
2024-07-11 20:41:07 +02:00
|
|
|
dance_club: 10
|
2024-07-11 23:25:29 +02:00
|
|
|
}.each_with_object([]) do |(affinity_group, count), acc|
|
|
|
|
count.times { acc << affinity_group }
|
|
|
|
end
|
|
|
|
|
2024-08-01 18:27:41 +00:00
|
|
|
NUMBER_OF_GUESTS.times do
|
2024-07-11 23:25:29 +02:00
|
|
|
guest = Guest.create!(first_name: Faker::Name.first_name,
|
2024-07-11 23:25:29 +02:00
|
|
|
last_name: Faker::Name.last_name,
|
|
|
|
email: Faker::Internet.email,
|
|
|
|
phone: Faker::PhoneNumber.cell_phone)
|
2024-07-11 23:25:29 +02:00
|
|
|
|
|
|
|
guest.affinity_group_list.add(samples.sample)
|
|
|
|
guest.save!
|
2024-07-11 20:41:07 +02:00
|
|
|
end
|
2024-07-11 23:30:02 +02:00
|
|
|
|
2024-07-31 20:58:47 +02:00
|
|
|
# Add unbreakable bonds
|
2024-07-11 23:39:40 +02:00
|
|
|
Guest.affinity_group_counts.each do |group|
|
|
|
|
couples = (group.taggings_count / 4).floor
|
2024-07-11 23:30:02 +02:00
|
|
|
|
2024-07-11 23:39:40 +02:00
|
|
|
guests_involved = Guest.tagged_with(group.name).limit(couples * 2)
|
|
|
|
guests_involved.each_slice(2) do |a, b|
|
|
|
|
bond_name = "#{a.full_name} & #{b.full_name}"
|
2024-07-11 23:30:02 +02:00
|
|
|
|
2024-07-11 23:39:40 +02:00
|
|
|
a.unbreakable_bond_list.add(bond_name)
|
|
|
|
b.unbreakable_bond_list.add(bond_name)
|
2024-07-11 23:30:02 +02:00
|
|
|
|
2024-07-11 23:39:40 +02:00
|
|
|
a.save!
|
|
|
|
b.save!
|
|
|
|
end
|
|
|
|
end
|