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 03a9cd2
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 10 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} contract of employment at %{provider}?"
errors:
inclusion: "Select yes if %{claimant} has a fixed term contract of employment at %{provider}"
teaching_responsibilities:
Expand Down

0 comments on commit 03a9cd2

Please sign in to comment.