Skip to content

Commit

Permalink
Update application seeding with assessment decision
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickjfl committed Sep 19, 2024
1 parent 3945c2f commit dec948e
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion db/fixtures/development/02_landing_applications.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit dec948e

Please sign in to comment.