Skip to content

Commit

Permalink
update: alta/baja adopter_application seed block to have a form_submi…
Browse files Browse the repository at this point in the history
…ssion to belong to
  • Loading branch information
Gabe-Torres committed Jul 2, 2024
1 parent d7d499b commit ae88ab5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 5 additions & 2 deletions db/seeds/01_alta.rb
Original file line number Diff line number Diff line change
Expand Up @@ -401,17 +401,20 @@
end_date: upcoming_end_date
)

@form_submission = FormSubmission.create!(organization: @organization, person: Person.create!(name: "John Doe", email: "Doe@gmail.com"))

10.times do
adopter_application = AdopterApplication.new(
notes: Faker::Lorem.paragraph,
profile_show: true,
status: rand(0..4),
adopter_foster_account: AdopterFosterAccount.all.sample,
pet: Pet.all.sample
pet: Pet.all.sample,
form_submission: @form_submission
)

# Prevent duplicate adopter applications.
redo if AdopterApplication.where(pet_id: adopter_application.pet_id,
redo if AdopterApplication.where(pet_id: adopter_application.pet_id, form_submission_id: adopter_application.form_submission_id,
adopter_foster_account_id: adopter_application.adopter_foster_account_id).exists?

if adopter_application.valid?
Expand Down
5 changes: 4 additions & 1 deletion db/seeds/02_baja.rb
Original file line number Diff line number Diff line change
Expand Up @@ -354,13 +354,16 @@
end_date: upcoming_end_date
)

@form_submission = FormSubmission.create!(organization: @organization, person: Person.create!(name: "John Doe", email: "Doe@gmail.com"))

10.times do
adopter_application = AdopterApplication.new(
notes: Faker::Lorem.paragraph,
profile_show: true,
status: rand(0..4),
adopter_foster_account: AdopterFosterAccount.all.sample,
pet: Pet.all.sample
pet: Pet.all.sample,
form_submission: @form_submission
)

# Prevent duplicate adopter applications.
Expand Down

0 comments on commit ae88ab5

Please sign in to comment.