Compare commits
1 Commits
ecbb6af4bd
...
d234ead580
Author | SHA1 | Date | |
---|---|---|---|
d234ead580 |
@ -1,3 +1,5 @@
|
|||||||
|
# Copyright (C) 2024-2025 LibreWeddingPlanner contributors
|
||||||
|
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
|
52
db/seeds.rb
52
db/seeds.rb
@ -1,8 +1,6 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
# Copyright (C) 2024-2025 LibreWeddingPlanner contributors
|
# Copyright (C) 2024-2025 LibreWeddingPlanner contributors
|
||||||
|
|
||||||
NUMBER_OF_GUESTS = 200
|
NUMBER_OF_GUESTS = 50
|
||||||
|
|
||||||
ActsAsTenant.without_tenant do
|
ActsAsTenant.without_tenant do
|
||||||
Wedding.delete_all
|
Wedding.delete_all
|
||||||
@ -11,22 +9,20 @@ end
|
|||||||
wedding = Wedding.create!(slug: :default)
|
wedding = Wedding.create!(slug: :default)
|
||||||
|
|
||||||
ActsAsTenant.with_tenant(wedding) do
|
ActsAsTenant.with_tenant(wedding) do
|
||||||
[
|
Expense.create!(name: 'Photographer', amount: 3000, pricing_type: 'fixed')
|
||||||
{ name: 'Photographer', amount: 3000, pricing_type: 'fixed' },
|
Expense.create!(name: 'Country house', amount: 6000, pricing_type: 'fixed')
|
||||||
{ name: 'Country house', amount: 6000, pricing_type: 'fixed' },
|
Expense.create!(name: 'Catering', amount: 200, pricing_type: 'per_person')
|
||||||
{ name: 'Catering', amount: 200, pricing_type: 'per_person' },
|
Expense.create!(name: 'Flowers', amount: 500, pricing_type: 'fixed')
|
||||||
{ name: 'Flowers', amount: 500, pricing_type: 'fixed' },
|
Expense.create!(name: 'Band', amount: 1000, pricing_type: 'fixed')
|
||||||
{ name: 'Band', amount: 1000, pricing_type: 'fixed' },
|
Expense.create!(name: 'Wedding planner', amount: 2000, pricing_type: 'fixed')
|
||||||
{ name: 'Wedding planner', amount: 2000, pricing_type: 'fixed' },
|
Expense.create!(name: 'Dress', amount: 1000, pricing_type: 'fixed')
|
||||||
{ name: 'Dress', amount: 1000, pricing_type: 'fixed' },
|
Expense.create!(name: 'Suit', amount: 500, pricing_type: 'fixed')
|
||||||
{ name: 'Suit', amount: 500, pricing_type: 'fixed' },
|
Expense.create!(name: 'Rings', amount: 1000, pricing_type: 'fixed')
|
||||||
{ name: 'Rings', amount: 1000, pricing_type: 'fixed' },
|
Expense.create!(name: 'Makeup', amount: 200, pricing_type: 'fixed')
|
||||||
{ name: 'Makeup', amount: 200, pricing_type: 'fixed' },
|
Expense.create!(name: 'Hair', amount: 200, pricing_type: 'fixed')
|
||||||
{ name: 'Hair', amount: 200, pricing_type: 'fixed' },
|
Expense.create!(name: 'Transportation', amount: 3000, pricing_type: 'fixed')
|
||||||
{ name: 'Transportation', amount: 3000, pricing_type: 'fixed' },
|
Expense.create!(name: 'Invitations', amount: 200, pricing_type: 'fixed')
|
||||||
{ name: 'Invitations', amount: 200, pricing_type: 'fixed' },
|
Expense.create!(name: 'Cake', amount: 500, pricing_type: 'fixed')
|
||||||
{ name: 'Cake', amount: 500, pricing_type: 'fixed' }
|
|
||||||
].then { Expense.insert_all!(it) }
|
|
||||||
|
|
||||||
Group.create!(name: "Jim's guests", icon: 'pi pi-heart').tap do |parent|
|
Group.create!(name: "Jim's guests", icon: 'pi pi-heart').tap do |parent|
|
||||||
parent.children.create!(name: "Jim's family", icon: 'pi pi-users').tap do |family|
|
parent.children.create!(name: "Jim's family", icon: 'pi pi-users').tap do |family|
|
||||||
@ -60,21 +56,19 @@ ActsAsTenant.with_tenant(wedding) do
|
|||||||
|
|
||||||
groups = Group.all
|
groups = Group.all
|
||||||
|
|
||||||
invitations = ([{}] * (NUMBER_OF_GUESTS * 0.8)).then { Invitation.insert_all!(it) }.rows.flatten
|
NUMBER_OF_GUESTS.times do
|
||||||
|
Guest.create!(
|
||||||
NUMBER_OF_GUESTS.times.map do |i|
|
|
||||||
{
|
|
||||||
name: Faker::Name.name,
|
name: Faker::Name.name,
|
||||||
phone: Faker::PhoneNumber.cell_phone,
|
phone: Faker::PhoneNumber.cell_phone,
|
||||||
group_id: groups.sample.id,
|
group: groups.sample,
|
||||||
status: Guest.statuses.keys.sample,
|
status: Guest.statuses.keys.sample,
|
||||||
invitation_id: invitations[i]
|
invitation: (Invitation.create!(wedding:) if rand > 0.1),
|
||||||
}
|
)
|
||||||
end.then { Guest.insert_all!(it) }
|
end
|
||||||
|
|
||||||
ActiveJob.perform_all_later(3.times.map { TableSimulatorJob.new(wedding.id) })
|
ActiveJob.perform_all_later(3.times.map { TableSimulatorJob.new(wedding.id) })
|
||||||
|
|
||||||
"red".dup.paint.palette.triad(as: :hex).zip(Group.roots).each { |(color, group)| group.update!(color: color.paint.desaturate(40)) }
|
'red'.paint.palette.triad(as: :hex).zip(Group.roots).each { |(color, group)| group.update!(color: color.paint.desaturate(40)) }
|
||||||
|
|
||||||
Group.roots.each(&:colorize_children)
|
Group.roots.each(&:colorize_children)
|
||||||
|
|
||||||
@ -82,6 +76,6 @@ ActsAsTenant.with_tenant(wedding) do
|
|||||||
email: 'development@example.com',
|
email: 'development@example.com',
|
||||||
confirmed_at: Time.zone.now,
|
confirmed_at: Time.zone.now,
|
||||||
password: 'supersecretpassword',
|
password: 'supersecretpassword',
|
||||||
password_confirmation: 'supersecretpassword'
|
password_confirmation: 'supersecretpassword',
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
# Copyright (C) 2024-2025 LibreWeddingPlanner contributors
|
||||||
|
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
FactoryBot.define do
|
FactoryBot.define do
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
# Copyright (C) 2024-2025 LibreWeddingPlanner contributors
|
||||||
|
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user