diff --git a/db/seeds.rb b/db/seeds.rb index edf50c6314..49b654e240 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -220,7 +220,12 @@ sanction_check: "written", }, { name: "Quebec", status_check: "written", sanction_check: "written" }, - { name: "Alberta", status_check: "written", sanction_check: "written" }, + { + name: "Alberta", + status_check: "written", + sanction_check: "written", + teaching_authority_provides_written_statement: true, + }, { name: "British Columbia", status_check: "online", @@ -247,9 +252,21 @@ sanction_check: "online", }, ], - "HK" => [{ status_check: "written", sanction_check: "written" }], - "IN" => [], - "JM" => [{ status_check: "written", sanction_check: "written" }], + "HK" => [ + { + status_check: "written", + sanction_check: "written", + teaching_authority_provides_written_statement: true, + }, + ], + "IN" => [{ requires_preliminary_check: true }], + "JM" => [ + { + status_check: "written", + sanction_check: "written", + requires_preliminary_check: true, + }, + ], "NG" => [ { requires_preliminary_check: true, @@ -262,7 +279,13 @@ }, ], "SG" => [{ status_check: "online" }], - "ZA" => [{ status_check: "written", sanction_check: "written" }], + "ZA" => [ + { + status_check: "written", + sanction_check: "written", + requires_preliminary_check: true, + }, + ], "UA" => [{ reduced_evidence_accepted: true }], "ZW" => [{ status_check: "written" }], "GG" => [], diff --git a/lib/tasks/example_data.rake b/lib/tasks/example_data.rake index a7657cb2c0..fa1e2b6089 100644 --- a/lib/tasks/example_data.rake +++ b/lib/tasks/example_data.rake @@ -132,11 +132,11 @@ def application_form_traits_for(region) [], traits, traits + %i[submitted], - traits + %i[preliminary_check], + (traits + %i[preliminary_check] if region.requires_preliminary_check), traits + %i[waiting_on], traits + %i[awarded], traits + %i[declined], - ] + ].compact end def create_application_forms @@ -148,21 +148,57 @@ def create_application_forms assessment = AssessmentFactory.call(application_form:) - if application_form.teaching_authority_provides_written_statement - FactoryBot.create( - :professional_standing_request, - :requested, - assessment:, - ) - application_form.update!(waiting_on_professional_standing: true) - elsif application_form.waiting_on? - if application_form.needs_written_statement && rand(2).zero? + if application_form.waiting_on? + if application_form.teaching_authority_provides_written_statement FactoryBot.create( :professional_standing_request, :requested, assessment:, ) - application_form.update!(waiting_on_professional_standing: true) + application_form.update!( + statuses: %w[waiting_on_lops], + stage: "pre_assessment", + waiting_on_professional_standing: true, + ) + elsif application_form.needs_written_statement && rand(4).zero? + FactoryBot.create( + :professional_standing_request, + :requested, + assessment:, + ) + application_form.update!( + statuses: %w[waiting_on_lops], + stage: "verification", + waiting_on_professional_standing: true, + ) + elsif (work_history = application_form.work_histories.first) && + rand(3).zero? + reference_request_trait = ReferenceRequest.states.keys.sample + FactoryBot.create( + :reference_request, + reference_request_trait, + assessment:, + work_history:, + ) + application_form.update!( + statuses: %w[waiting_on_reference], + stage: "verification", + waiting_on_reference: true, + ) + elsif (qualification = application_form.qualifications.first) && + rand(2).zero? + qualification_trait = ReferenceRequest.states.keys.sample + FactoryBot.create( + :qualification_request, + qualification_trait, + assessment:, + qualification:, + ) + application_form.update!( + statuses: %w[waiting_on_qualification], + stage: "verification", + waiting_on_qualification: true, + ) else FactoryBot.create( :further_information_request, @@ -170,18 +206,12 @@ def create_application_forms :with_items, assessment:, ) - application_form.update!(waiting_on_further_information: true) + application_form.update!( + statuses: %w[waiting_on_further_information], + stage: "assessment", + waiting_on_further_information: true, + ) end - elsif (work_history = application_form.work_histories.first) && - rand(2).zero? - reference_request_trait = ReferenceRequest.states.keys.sample - FactoryBot.create( - :reference_request, - reference_request_trait, - assessment:, - work_history:, - ) - application_form.update!(waiting_on_reference: true) end end end