From 020b384a369addb164acbb3a07484756eb476b98 Mon Sep 17 00:00:00 2001 From: Richard Lynch Date: Fri, 6 Sep 2024 15:28:23 +0100 Subject: [PATCH] Show type of contract claimant selected Previously we were always showing permanent, we need to show the option the claimant selected. --- .../provider/verify_claim_form.rb | 30 ++++++++++++++----- .../provider/claims/verify_claim.html.erb | 3 +- config/locales/en.yml | 2 +- .../provider_verifying_claims_spec.rb | 8 +++-- 4 files changed, 30 insertions(+), 13 deletions(-) diff --git a/app/forms/journeys/further_education_payments/provider/verify_claim_form.rb b/app/forms/journeys/further_education_payments/provider/verify_claim_form.rb index 749eec2770..3950386ca3 100644 --- a/app/forms/journeys/further_education_payments/provider/verify_claim_form.rb +++ b/app/forms/journeys/further_education_payments/provider/verify_claim_form.rb @@ -63,15 +63,17 @@ def course_descriptions @course_descriptions ||= claim.eligibility.courses_taught.map(&:description) end + def claimant_contract_of_employment + claimant_option_selected( + "contract_type", + claim.eligibility.contract_type + ).downcase + end + def teaching_hours_per_week - I18n.t( - [ - "further_education_payments", - "forms", - "teaching_hours_per_week", - "options", - claim.eligibility.teaching_hours_per_week - ].join(".") + claimant_option_selected( + "teaching_hours_per_week", + claim.eligibility.teaching_hours_per_week ).downcase end @@ -132,6 +134,18 @@ def permitted_attributes super + [assertions_attributes: AssertionForm.attribute_names] end + def claimant_option_selected(question, option) + I18n.t( + [ + "further_education_payments", + "forms", + question, + "options", + option + ].join(".") + ) + end + # Make sure the errors in the summary link to the correct nested field def all_assertions_answered assertions.each(&:validate).each_with_index do |assertion, i| diff --git a/app/views/further_education_payments/provider/claims/verify_claim.html.erb b/app/views/further_education_payments/provider/claims/verify_claim.html.erb index 2418aa6baf..11b816c864 100644 --- a/app/views/further_education_payments/provider/claims/verify_claim.html.erb +++ b/app/views/further_education_payments/provider/claims/verify_claim.html.erb @@ -63,7 +63,8 @@ [:assertions, f.object.contract_type, ff.object.name, :label], claimant: f.object.claimant_name, provider: f.object.claim.school.name, - hours: f.object.teaching_hours_per_week + hours: f.object.teaching_hours_per_week, + type_of_contract: f.object.claimant_contract_of_employment ), }, hint: -> do diff --git a/config/locales/en.yml b/config/locales/en.yml index fc0dd80fbe..27e301144b 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1174,7 +1174,7 @@ en: assertions: fixed_contract: contract_type: - label: "Does %{claimant} have a permanent contract of employment at %{provider}?" + label: "Does %{claimant} have a %{type_of_contract} of employment at %{provider}?" errors: inclusion: "Select yes if %{claimant} has a fixed term contract of employment at %{provider}" teaching_responsibilities: diff --git a/spec/features/further_education_payments/provider/provider_verifying_claims_spec.rb b/spec/features/further_education_payments/provider/provider_verifying_claims_spec.rb index 5a24d6d5e9..5ed1ae7acc 100644 --- a/spec/features/further_education_payments/provider/provider_verifying_claims_spec.rb +++ b/spec/features/further_education_payments/provider/provider_verifying_claims_spec.rb @@ -272,7 +272,8 @@ :further_education_payments_eligibility, claim: claim_1, school: fe_provider, - teaching_hours_per_week: "more_than_12" + teaching_hours_per_week: "more_than_12", + contract_type: "fixed_term" ) claim_2 = create( @@ -288,7 +289,8 @@ :further_education_payments_eligibility, claim: claim_2, school: fe_provider, - teaching_hours_per_week: "more_than_12" + teaching_hours_per_week: "more_than_12", + contract_type: "fixed_term" ) mock_dfe_sign_in_auth_session( @@ -446,7 +448,7 @@ expect(page).to have_text "Claim date1 August 2024" within_fieldset( - "Does Edna Krabappel have a permanent contract of employment at " \ + "Does Edna Krabappel have a fixed-term contract of employment at " \ "Springfield A and M?" ) do choose "Yes"