From 27b4f7ee087063b1477c2cfaf7dba7089da1f84e Mon Sep 17 00:00:00 2001 From: Patrick Fleming Date: Tue, 17 Sep 2024 14:11:22 +0100 Subject: [PATCH] Update application seeding with assessment decision --- db/fixtures/development/02_landing_applications.rb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/db/fixtures/development/02_landing_applications.rb b/db/fixtures/development/02_landing_applications.rb index e45e3b8e..64d6336e 100644 --- a/db/fixtures/development/02_landing_applications.rb +++ b/db/fixtures/development/02_landing_applications.rb @@ -16,13 +16,25 @@ def seed landing_date = landing_date(temporality: seed.fetch(:temporality)) s.landing_date = landing_date s.departure_date = up_to_twelve_days_ahead(landing_date) - s.application_submitted_at = upto_forty_five_days_before(landing_date) + + application_submitted_at = upto_forty_five_days_before(landing_date) + s.application_submitted_at = application_submitted_at + + application_decision = [:approved, :denied, nil].sample + s.application_decision = application_decision + if [:approved, :denied].include?(application_decision) + s.application_decision_made_at = between_submission_and_landing_dates(landing_date, application_submitted_at) + end s.application_reference = ApplicationReferenceGenerator.generate end end end + def between_submission_and_landing_dates(landing_date, submission_date) + rand(submission_date..landing_date) + end + def up_to_twelve_days_ahead(landing_date) landing_date + rand(1..12).days end