Skip to content

Commit

Permalink
Update example data
Browse files Browse the repository at this point in the history
This updates the example data for the new filters to ensure it's more
accurate.
  • Loading branch information
thomasleese committed Sep 24, 2023
1 parent e710cbb commit cfb562b
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 28 deletions.
33 changes: 28 additions & 5 deletions db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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,
Expand All @@ -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" => [],
Expand Down
76 changes: 53 additions & 23 deletions lib/tasks/example_data.rake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -148,40 +148,70 @@ 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,
:requested,
: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
Expand Down

0 comments on commit cfb562b

Please sign in to comment.