Skip to content

Commit

Permalink
Show type of contract claimant selected
Browse files Browse the repository at this point in the history
Previously we were always showing permanent, we need to show the option
the claimant selected.
  • Loading branch information
rjlynch committed Sep 6, 2024
1 parent 70e2766 commit 020b384
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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(
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 020b384

Please sign in to comment.