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 Oct 4, 2023
1 parent 1d3fb0b commit 2eaab70
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 18 deletions.
32 changes: 28 additions & 4 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 Down Expand Up @@ -250,13 +255,26 @@
},
],
},
"HK" => [{ status_check: "written", sanction_check: "written" }],
"HK" => [
{
status_check: "written",
sanction_check: "written",
teaching_authority_provides_written_statement: true,
},
],
"IN" => {
subject_limited: true,
regions: [{ requires_preliminary_check: true }],
},
"JM" => {
subject_limited: true,
regions: [{ status_check: "written", sanction_check: "written" }],
regions: [
{
status_check: "written",
sanction_check: "written",
requires_preliminary_check: true,
},
],
},
"NG" => {
subject_limited: true,
Expand All @@ -278,7 +296,13 @@
},
"ZA" => {
subject_limited: true,
regions: [{ status_check: "written", sanction_check: "written" }],
regions: [
{
status_check: "written",
sanction_check: "written",
requires_preliminary_check: true,
},
],
},
"UA" => [{ reduced_evidence_accepted: true }],
"ZW" => {
Expand Down
72 changes: 58 additions & 14 deletions lib/tasks/example_data.rake
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,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 @@ -163,29 +163,69 @@ 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?
Expand All @@ -195,7 +235,11 @@ def create_application_forms
assessment:,
work_history:,
)
application_form.update!(waiting_on_reference: true)
application_form.update!(
statuses: %w[waiting_on_reference],
stage: "verification",
waiting_on_reference: true,
)
end
end
end
Expand Down

0 comments on commit 2eaab70

Please sign in to comment.