diff --git a/app/validations/soft_validations.rb b/app/validations/soft_validations.rb index 7b6cd40ae..dc3593136 100644 --- a/app/validations/soft_validations.rb +++ b/app/validations/soft_validations.rb @@ -9,12 +9,12 @@ private net_income_errors = {} if weekly_net_income && person_1_economic_status && override_net_income_validation.blank? if weekly_net_income < applicable_income_range.soft_min && weekly_net_income > applicable_income_range.hard_min - net_income_errors["weekly_net_income"] = OpenStruct.new( + net_income_errors["override_net_income_validation"] = OpenStruct.new( message: "Net income is lower than expected based on the main tenant's working situation. Are you sure this is correct?", hint_text: "This is based on the tenant's work situation: #{person_1_economic_status}", ) elsif weekly_net_income > applicable_income_range.soft_max && weekly_net_income < applicable_income_range.hard_max - net_income_errors["weekly_net_income"] = OpenStruct.new( + net_income_errors["override_net_income_validation"] = OpenStruct.new( message: "Net income is higher than expected based on the main tenant's working situation. Are you sure this is correct?", hint_text: "This is based on the tenant's work situation: #{person_1_economic_status}", ) diff --git a/app/views/form/_validation_override_question.html.erb b/app/views/form/_validation_override_question.html.erb index d893c53a4..947791e75 100644 --- a/app/views/form/_validation_override_question.html.erb +++ b/app/views/form/_validation_override_question.html.erb @@ -1,11 +1,11 @@
- <%= f.govuk_check_boxes_fieldset :override_net_income_validation, + <%= f.govuk_check_boxes_fieldset @case_log.soft_errors.keys.first, legend: { text: @case_log.soft_errors.values.first.message, size: "l" }, hint: { text: @case_log.soft_errors.values.first.hint_text } do %> - <%= f.govuk_check_box :override_net_income_validation, "override_net_income_validation", + <%= f.govuk_check_box @case_log.soft_errors.keys.first, @case_log.soft_errors.keys.first, label: { text: "Yes" }, - checked: f.object.send("override_net_income_validation") + checked: f.object.send(@case_log.soft_errors.keys.first) %> <% end %>