From 548c2007e4624319771e7f41f62be5a30b32bbfc Mon Sep 17 00:00:00 2001 From: Manny Dinssa <44172848+Dinssa@users.noreply.github.com> Date: Mon, 10 Mar 2025 08:30:24 +0000 Subject: [PATCH 1/2] CLDC-3905 BU Sales 25/26 Buyer relationship validation error (student/child check) (#2972) * Remove student_not_child_value_check in 2025 * Correct field numbering on person 4 and 5 * Update test --- .../subsections/household_characteristics.rb | 36 +++++++++---------- .../bulk_upload/sales/year2025/row_parser.rb | 8 ++--- .../forms/2025/sales/soft_validations.en.yml | 9 ----- .../household_characteristics_spec.rb | 18 ---------- 4 files changed, 22 insertions(+), 49 deletions(-) diff --git a/app/models/form/sales/subsections/household_characteristics.rb b/app/models/form/sales/subsections/household_characteristics.rb index 5c3c0b9e3..a1f21ae8e 100644 --- a/app/models/form/sales/subsections/household_characteristics.rb +++ b/app/models/form/sales/subsections/household_characteristics.rb @@ -39,20 +39,20 @@ class Form::Sales::Subsections::HouseholdCharacteristics < ::Form::Subsection Form::Sales::Pages::Buyer1LiveInProperty.new(nil, nil, self), Form::Sales::Pages::BuyerLiveInValueCheck.new("buyer_1_live_in_property_value_check", nil, self, person_index: 1), (form.start_year_2025_or_later? ? Form::Sales::Pages::Buyer2RelationshipToBuyer1YesNo.new(nil, nil, self) : Form::Sales::Pages::Buyer2RelationshipToBuyer1.new(nil, nil, self)), - Form::Sales::Pages::PersonStudentNotChildValueCheck.new("buyer_2_relationship_student_not_child_value_check", nil, self, person_index: 2), + (Form::Sales::Pages::PersonStudentNotChildValueCheck.new("buyer_2_relationship_student_not_child_value_check", nil, self, person_index: 2) unless form.start_year_2025_or_later?), Form::Sales::Pages::Age2.new(nil, nil, self), Form::Sales::Pages::OldPersonsSharedOwnershipValueCheck.new("age_2_old_persons_shared_ownership_joint_purchase_value_check", nil, self, joint_purchase: true), Form::Sales::Pages::OldPersonsSharedOwnershipValueCheck.new("age_2_old_persons_shared_ownership_value_check", nil, self, joint_purchase: false), Form::Sales::Pages::RetirementValueCheck.new("age_2_buyer_retirement_value_check", nil, self, person_index: 2), (Form::Sales::Pages::NotRetiredValueCheck.new("age_2_buyer_not_retired_value_check", nil, self, person_index: 2) if form.start_year_2024_or_later?), - Form::Sales::Pages::PersonStudentNotChildValueCheck.new("buyer_2_age_student_not_child_value_check", nil, self, person_index: 2), + (Form::Sales::Pages::PersonStudentNotChildValueCheck.new("buyer_2_age_student_not_child_value_check", nil, self, person_index: 2) unless form.start_year_2025_or_later?), Form::Sales::Pages::GenderIdentity2.new(nil, nil, self), buyer_2_ethnicity_nationality_pages, Form::Sales::Pages::Buyer2WorkingSituation.new(nil, nil, self), Form::Sales::Pages::RetirementValueCheck.new("working_situation_2_retirement_value_check_joint_purchase", nil, self, person_index: 2), (Form::Sales::Pages::NotRetiredValueCheck.new("working_situation_2_not_retired_value_check_joint_purchase", nil, self, person_index: 2) if form.start_year_2024_or_later?), Form::Sales::Pages::Buyer2IncomeEcstatValueCheck.new("working_situation_buyer_2_income_value_check", nil, self), - Form::Sales::Pages::PersonStudentNotChildValueCheck.new("buyer_2_working_situation_student_not_child_value_check", nil, self, person_index: 2), + (Form::Sales::Pages::PersonStudentNotChildValueCheck.new("buyer_2_working_situation_student_not_child_value_check", nil, self, person_index: 2) unless form.start_year_2025_or_later?), Form::Sales::Pages::Buyer2LiveInProperty.new(nil, nil, self), Form::Sales::Pages::BuyerLiveInValueCheck.new("buyer_2_live_in_property_value_check", nil, self, person_index: 2), Form::Sales::Pages::NumberOfOthersInProperty.new("number_of_others_in_property", nil, self, joint_purchase: false), @@ -61,77 +61,77 @@ class Form::Sales::Subsections::HouseholdCharacteristics < ::Form::Subsection (form.start_year_2025_or_later? ? Form::Sales::Pages::PersonRelationshipToBuyer1YesNo.new("person_2_relationship_to_buyer_1", nil, self, person_index: 2) : Form::Sales::Pages::PersonRelationshipToBuyer1.new("person_2_relationship_to_buyer_1", nil, self, person_index: 2)), (Form::Sales::Pages::PartnerUnder16ValueCheck.new("relationship_2_partner_under_16_value_check", nil, self, person_index: 2) if form.start_year_2024_or_later?), (Form::Sales::Pages::MultiplePartnersValueCheck.new("relationship_2_multiple_partners_value_check", nil, self, person_index: 2) if form.start_year_2024_or_later?), - Form::Sales::Pages::PersonStudentNotChildValueCheck.new("relationship_2_student_not_child_value_check", nil, self, person_index: 2), + (Form::Sales::Pages::PersonStudentNotChildValueCheck.new("relationship_2_student_not_child_value_check", nil, self, person_index: 2) unless form.start_year_2025_or_later?), Form::Sales::Pages::PersonAge.new("person_2_age", nil, self, person_index: 2), Form::Sales::Pages::RetirementValueCheck.new("age_2_retirement_value_check", nil, self, person_index: 2), (Form::Sales::Pages::NotRetiredValueCheck.new("age_2_not_retired_value_check", nil, self, person_index: 2) if form.start_year_2024_or_later?), - Form::Sales::Pages::PersonStudentNotChildValueCheck.new("age_2_student_not_child_value_check", nil, self, person_index: 2), + (Form::Sales::Pages::PersonStudentNotChildValueCheck.new("age_2_student_not_child_value_check", nil, self, person_index: 2) unless form.start_year_2025_or_later?), (Form::Sales::Pages::PartnerUnder16ValueCheck.new("age_2_partner_under_16_value_check", nil, self, person_index: 2) if form.start_year_2024_or_later?), Form::Sales::Pages::PersonGenderIdentity.new("person_2_gender_identity", nil, self, person_index: 2), Form::Sales::Pages::PersonWorkingSituation.new("person_2_working_situation", nil, self, person_index: 2), Form::Sales::Pages::RetirementValueCheck.new("working_situation_2_retirement_value_check", nil, self, person_index: 2), (Form::Sales::Pages::NotRetiredValueCheck.new("working_situation_2_not_retired_value_check", nil, self, person_index: 2) if form.start_year_2024_or_later?), - Form::Sales::Pages::PersonStudentNotChildValueCheck.new("working_situation_2_student_not_child_value_check", nil, self, person_index: 2), + (Form::Sales::Pages::PersonStudentNotChildValueCheck.new("working_situation_2_student_not_child_value_check", nil, self, person_index: 2) unless form.start_year_2025_or_later?), Form::Sales::Pages::PersonKnown.new("person_3_known", nil, self, person_index: 3), (form.start_year_2025_or_later? ? Form::Sales::Pages::PersonRelationshipToBuyer1YesNo.new("person_3_relationship_to_buyer_1", nil, self, person_index: 3) : Form::Sales::Pages::PersonRelationshipToBuyer1.new("person_3_relationship_to_buyer_1", nil, self, person_index: 3)), (Form::Sales::Pages::PartnerUnder16ValueCheck.new("relationship_3_partner_under_16_value_check", nil, self, person_index: 3) if form.start_year_2024_or_later?), (Form::Sales::Pages::MultiplePartnersValueCheck.new("relationship_3_multiple_partners_value_check", nil, self, person_index: 3) if form.start_year_2024_or_later?), - Form::Sales::Pages::PersonStudentNotChildValueCheck.new("relationship_3_student_not_child_value_check", nil, self, person_index: 3), + (Form::Sales::Pages::PersonStudentNotChildValueCheck.new("relationship_3_student_not_child_value_check", nil, self, person_index: 3) unless form.start_year_2025_or_later?), Form::Sales::Pages::PersonAge.new("person_3_age", nil, self, person_index: 3), Form::Sales::Pages::RetirementValueCheck.new("age_3_retirement_value_check", nil, self, person_index: 3), (Form::Sales::Pages::NotRetiredValueCheck.new("age_3_not_retired_value_check", nil, self, person_index: 3) if form.start_year_2024_or_later?), - Form::Sales::Pages::PersonStudentNotChildValueCheck.new("age_3_student_not_child_value_check", nil, self, person_index: 3), + (Form::Sales::Pages::PersonStudentNotChildValueCheck.new("age_3_student_not_child_value_check", nil, self, person_index: 3) unless form.start_year_2025_or_later?), (Form::Sales::Pages::PartnerUnder16ValueCheck.new("age_3_partner_under_16_value_check", nil, self, person_index: 3) if form.start_year_2024_or_later?), Form::Sales::Pages::PersonGenderIdentity.new("person_3_gender_identity", nil, self, person_index: 3), Form::Sales::Pages::PersonWorkingSituation.new("person_3_working_situation", nil, self, person_index: 3), Form::Sales::Pages::RetirementValueCheck.new("working_situation_3_retirement_value_check", nil, self, person_index: 3), (Form::Sales::Pages::NotRetiredValueCheck.new("working_situation_3_not_retired_value_check", nil, self, person_index: 3) if form.start_year_2024_or_later?), - Form::Sales::Pages::PersonStudentNotChildValueCheck.new("working_situation_3_student_not_child_value_check", nil, self, person_index: 3), + (Form::Sales::Pages::PersonStudentNotChildValueCheck.new("working_situation_3_student_not_child_value_check", nil, self, person_index: 3) unless form.start_year_2025_or_later?), Form::Sales::Pages::PersonKnown.new("person_4_known", nil, self, person_index: 4), (form.start_year_2025_or_later? ? Form::Sales::Pages::PersonRelationshipToBuyer1YesNo.new("person_4_relationship_to_buyer_1", nil, self, person_index: 4) : Form::Sales::Pages::PersonRelationshipToBuyer1.new("person_4_relationship_to_buyer_1", nil, self, person_index: 4)), (Form::Sales::Pages::PartnerUnder16ValueCheck.new("relationship_4_partner_under_16_value_check", nil, self, person_index: 4) if form.start_year_2024_or_later?), (Form::Sales::Pages::MultiplePartnersValueCheck.new("relationship_4_multiple_partners_value_check", nil, self, person_index: 4) if form.start_year_2024_or_later?), - Form::Sales::Pages::PersonStudentNotChildValueCheck.new("relationship_4_student_not_child_value_check", nil, self, person_index: 4), + (Form::Sales::Pages::PersonStudentNotChildValueCheck.new("relationship_4_student_not_child_value_check", nil, self, person_index: 4) unless form.start_year_2025_or_later?), Form::Sales::Pages::PersonAge.new("person_4_age", nil, self, person_index: 4), Form::Sales::Pages::RetirementValueCheck.new("age_4_retirement_value_check", nil, self, person_index: 4), (Form::Sales::Pages::NotRetiredValueCheck.new("age_4_not_retired_value_check", nil, self, person_index: 4) if form.start_year_2024_or_later?), - Form::Sales::Pages::PersonStudentNotChildValueCheck.new("age_4_student_not_child_value_check", nil, self, person_index: 4), + (Form::Sales::Pages::PersonStudentNotChildValueCheck.new("age_4_student_not_child_value_check", nil, self, person_index: 4) unless form.start_year_2025_or_later?), (Form::Sales::Pages::PartnerUnder16ValueCheck.new("age_4_partner_under_16_value_check", nil, self, person_index: 4) if form.start_year_2024_or_later?), Form::Sales::Pages::PersonGenderIdentity.new("person_4_gender_identity", nil, self, person_index: 4), Form::Sales::Pages::PersonWorkingSituation.new("person_4_working_situation", nil, self, person_index: 4), Form::Sales::Pages::RetirementValueCheck.new("working_situation_4_retirement_value_check", nil, self, person_index: 4), (Form::Sales::Pages::NotRetiredValueCheck.new("working_situation_4_not_retired_value_check", nil, self, person_index: 4) if form.start_year_2024_or_later?), - Form::Sales::Pages::PersonStudentNotChildValueCheck.new("working_situation_4_student_not_child_value_check", nil, self, person_index: 4), + (Form::Sales::Pages::PersonStudentNotChildValueCheck.new("working_situation_4_student_not_child_value_check", nil, self, person_index: 4) unless form.start_year_2025_or_later?), Form::Sales::Pages::PersonKnown.new("person_5_known", nil, self, person_index: 5), (form.start_year_2025_or_later? ? Form::Sales::Pages::PersonRelationshipToBuyer1YesNo.new("person_5_relationship_to_buyer_1", nil, self, person_index: 5) : Form::Sales::Pages::PersonRelationshipToBuyer1.new("person_5_relationship_to_buyer_1", nil, self, person_index: 5)), (Form::Sales::Pages::PartnerUnder16ValueCheck.new("relationship_5_partner_under_16_value_check", nil, self, person_index: 5) if form.start_year_2024_or_later?), (Form::Sales::Pages::MultiplePartnersValueCheck.new("relationship_5_multiple_partners_value_check", nil, self, person_index: 5) if form.start_year_2024_or_later?), - Form::Sales::Pages::PersonStudentNotChildValueCheck.new("relationship_5_student_not_child_value_check", nil, self, person_index: 5), + (Form::Sales::Pages::PersonStudentNotChildValueCheck.new("relationship_5_student_not_child_value_check", nil, self, person_index: 5) unless form.start_year_2025_or_later?), Form::Sales::Pages::PersonAge.new("person_5_age", nil, self, person_index: 5), Form::Sales::Pages::RetirementValueCheck.new("age_5_retirement_value_check", nil, self, person_index: 5), (Form::Sales::Pages::NotRetiredValueCheck.new("age_5_not_retired_value_check", nil, self, person_index: 5) if form.start_year_2024_or_later?), - Form::Sales::Pages::PersonStudentNotChildValueCheck.new("age_5_student_not_child_value_check", nil, self, person_index: 5), + (Form::Sales::Pages::PersonStudentNotChildValueCheck.new("age_5_student_not_child_value_check", nil, self, person_index: 5) unless form.start_year_2025_or_later?), (Form::Sales::Pages::PartnerUnder16ValueCheck.new("age_5_partner_under_16_value_check", nil, self, person_index: 5) if form.start_year_2024_or_later?), Form::Sales::Pages::PersonGenderIdentity.new("person_5_gender_identity", nil, self, person_index: 5), Form::Sales::Pages::PersonWorkingSituation.new("person_5_working_situation", nil, self, person_index: 5), Form::Sales::Pages::RetirementValueCheck.new("working_situation_5_retirement_value_check", nil, self, person_index: 5), (Form::Sales::Pages::NotRetiredValueCheck.new("working_situation_5_not_retired_value_check", nil, self, person_index: 5) if form.start_year_2024_or_later?), - Form::Sales::Pages::PersonStudentNotChildValueCheck.new("working_situation_5_student_not_child_value_check", nil, self, person_index: 5), + (Form::Sales::Pages::PersonStudentNotChildValueCheck.new("working_situation_5_student_not_child_value_check", nil, self, person_index: 5) unless form.start_year_2025_or_later?), Form::Sales::Pages::PersonKnown.new("person_6_known", nil, self, person_index: 6), (form.start_year_2025_or_later? ? Form::Sales::Pages::PersonRelationshipToBuyer1YesNo.new("person_6_relationship_to_buyer_1", nil, self, person_index: 6) : Form::Sales::Pages::PersonRelationshipToBuyer1.new("person_6_relationship_to_buyer_1", nil, self, person_index: 6)), (Form::Sales::Pages::PartnerUnder16ValueCheck.new("relationship_6_partner_under_16_value_check", nil, self, person_index: 6) if form.start_year_2024_or_later?), (Form::Sales::Pages::MultiplePartnersValueCheck.new("relationship_6_multiple_partners_value_check", nil, self, person_index: 6) if form.start_year_2024_or_later?), - Form::Sales::Pages::PersonStudentNotChildValueCheck.new("relationship_6_student_not_child_value_check", nil, self, person_index: 6), + (Form::Sales::Pages::PersonStudentNotChildValueCheck.new("relationship_6_student_not_child_value_check", nil, self, person_index: 6) unless form.start_year_2025_or_later?), Form::Sales::Pages::PersonAge.new("person_6_age", nil, self, person_index: 6), Form::Sales::Pages::RetirementValueCheck.new("age_6_retirement_value_check", nil, self, person_index: 6), (Form::Sales::Pages::NotRetiredValueCheck.new("age_6_not_retired_value_check", nil, self, person_index: 6) if form.start_year_2024_or_later?), - Form::Sales::Pages::PersonStudentNotChildValueCheck.new("age_6_student_not_child_value_check", nil, self, person_index: 6), + (Form::Sales::Pages::PersonStudentNotChildValueCheck.new("age_6_student_not_child_value_check", nil, self, person_index: 6) unless form.start_year_2025_or_later?), (Form::Sales::Pages::PartnerUnder16ValueCheck.new("age_6_partner_under_16_value_check", nil, self, person_index: 6) if form.start_year_2024_or_later?), Form::Sales::Pages::PersonGenderIdentity.new("person_6_gender_identity", nil, self, person_index: 6), Form::Sales::Pages::PersonWorkingSituation.new("person_6_working_situation", nil, self, person_index: 6), Form::Sales::Pages::RetirementValueCheck.new("working_situation_6_retirement_value_check", nil, self, person_index: 6), (Form::Sales::Pages::NotRetiredValueCheck.new("working_situation_6_not_retired_value_check", nil, self, person_index: 6) if form.start_year_2024_or_later?), - Form::Sales::Pages::PersonStudentNotChildValueCheck.new("working_situation_6_student_not_child_value_check", nil, self, person_index: 6), + (Form::Sales::Pages::PersonStudentNotChildValueCheck.new("working_situation_6_student_not_child_value_check", nil, self, person_index: 6) unless form.start_year_2025_or_later?), ].flatten.compact end diff --git a/app/services/bulk_upload/sales/year2025/row_parser.rb b/app/services/bulk_upload/sales/year2025/row_parser.rb index f22910a29..feb607baf 100644 --- a/app/services/bulk_upload/sales/year2025/row_parser.rb +++ b/app/services/bulk_upload/sales/year2025/row_parser.rb @@ -662,7 +662,7 @@ private relat2: %i[field_34], relat3: %i[field_42], relat4: %i[field_46], - relat5: %i[field_49], + relat5: %i[field_50], relat6: %i[field_54], ecstat1: %i[field_32], @@ -821,10 +821,10 @@ private else (field_46 == 2 ? "X" : "R") end - attributes["relat5"] = if field_49 == 1 + attributes["relat5"] = if field_50 == 1 "P" else - (field_49 == 2 ? "X" : "R") + (field_50 == 2 ? "X" : "R") end attributes["relat6"] = if field_54 == 1 "P" @@ -1036,7 +1036,7 @@ private end def person_5_present? - field_51.present? || field_52.present? || field_49.present? + field_51.present? || field_52.present? || field_50.present? end def person_6_present? diff --git a/config/locales/forms/2025/sales/soft_validations.en.yml b/config/locales/forms/2025/sales/soft_validations.en.yml index 5bc6cb762..0e0afeb99 100644 --- a/config/locales/forms/2025/sales/soft_validations.en.yml +++ b/config/locales/forms/2025/sales/soft_validations.en.yml @@ -191,15 +191,6 @@ en: title_text: "You told us that buyer 2 will not live in the property." informative_text: "For %{ownership_scheme} types, the buyer usually lives in the property." - student_not_child_value_check: - page_header: "" - check_answer_label: "Student not a child confirmation" - check_answer_prompt: "Confirm student not a child" - hint_text: "" - question_text: "Are you sure this person is not a child?" - title_text: "You told us this person is a student aged between 16 and 19." - informative_text: "Are you sure this person is not a child?" - partner_under_16_value_check: page_header: "" check_answer_label: "Partner under 16 confirmation" diff --git a/spec/models/form/sales/subsections/household_characteristics_spec.rb b/spec/models/form/sales/subsections/household_characteristics_spec.rb index d892febc4..67f758ae3 100644 --- a/spec/models/form/sales/subsections/household_characteristics_spec.rb +++ b/spec/models/form/sales/subsections/household_characteristics_spec.rb @@ -309,13 +309,11 @@ RSpec.describe Form::Sales::Subsections::HouseholdCharacteristics, type: :model buyer_1_live_in_property buyer_1_live_in_property_value_check buyer_2_relationship_to_buyer_1 - buyer_2_relationship_student_not_child_value_check buyer_2_age age_2_old_persons_shared_ownership_joint_purchase_value_check age_2_old_persons_shared_ownership_value_check age_2_buyer_retirement_value_check age_2_buyer_not_retired_value_check - buyer_2_age_student_not_child_value_check buyer_2_gender_identity buyer_2_ethnic_group buyer_2_ethnic_background_black @@ -328,7 +326,6 @@ RSpec.describe Form::Sales::Subsections::HouseholdCharacteristics, type: :model working_situation_2_retirement_value_check_joint_purchase working_situation_2_not_retired_value_check_joint_purchase working_situation_buyer_2_income_value_check - buyer_2_working_situation_student_not_child_value_check buyer_2_live_in_property buyer_2_live_in_property_value_check number_of_others_in_property @@ -337,77 +334,62 @@ RSpec.describe Form::Sales::Subsections::HouseholdCharacteristics, type: :model person_2_relationship_to_buyer_1 relationship_2_partner_under_16_value_check relationship_2_multiple_partners_value_check - relationship_2_student_not_child_value_check person_2_age age_2_retirement_value_check age_2_not_retired_value_check - age_2_student_not_child_value_check age_2_partner_under_16_value_check person_2_gender_identity person_2_working_situation working_situation_2_retirement_value_check working_situation_2_not_retired_value_check - working_situation_2_student_not_child_value_check person_3_known person_3_relationship_to_buyer_1 relationship_3_partner_under_16_value_check relationship_3_multiple_partners_value_check - relationship_3_student_not_child_value_check person_3_age age_3_retirement_value_check age_3_not_retired_value_check - age_3_student_not_child_value_check age_3_partner_under_16_value_check person_3_gender_identity person_3_working_situation working_situation_3_retirement_value_check working_situation_3_not_retired_value_check - working_situation_3_student_not_child_value_check person_4_known person_4_relationship_to_buyer_1 relationship_4_partner_under_16_value_check relationship_4_multiple_partners_value_check - relationship_4_student_not_child_value_check person_4_age age_4_retirement_value_check age_4_not_retired_value_check - age_4_student_not_child_value_check age_4_partner_under_16_value_check person_4_gender_identity person_4_working_situation working_situation_4_retirement_value_check working_situation_4_not_retired_value_check - working_situation_4_student_not_child_value_check person_5_known person_5_relationship_to_buyer_1 relationship_5_partner_under_16_value_check relationship_5_multiple_partners_value_check - relationship_5_student_not_child_value_check person_5_age age_5_retirement_value_check age_5_not_retired_value_check - age_5_student_not_child_value_check age_5_partner_under_16_value_check person_5_gender_identity person_5_working_situation working_situation_5_retirement_value_check working_situation_5_not_retired_value_check - working_situation_5_student_not_child_value_check person_6_known person_6_relationship_to_buyer_1 relationship_6_partner_under_16_value_check relationship_6_multiple_partners_value_check - relationship_6_student_not_child_value_check person_6_age age_6_retirement_value_check age_6_not_retired_value_check - age_6_student_not_child_value_check age_6_partner_under_16_value_check person_6_gender_identity person_6_working_situation working_situation_6_retirement_value_check working_situation_6_not_retired_value_check - working_situation_6_student_not_child_value_check ], ) end From 16e1ffde0f9ad37ee1a24be67d026b3788573ef8 Mon Sep 17 00:00:00 2001 From: Manny Dinssa <44172848+Dinssa@users.noreply.github.com> Date: Mon, 10 Mar 2025 09:01:52 +0000 Subject: [PATCH 2/2] CLDC-3896: Remove "Answer" button from soft validation check errors page (#2973) * Hide link if question is unanswered * Remove "Answer" text * Lint * Update tests --- app/helpers/check_errors_helper.rb | 2 +- app/views/form/check_errors.html.erb | 2 +- spec/requests/check_errors_controller_spec.rb | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/helpers/check_errors_helper.rb b/app/helpers/check_errors_helper.rb index 3b3774566..c23b89c40 100644 --- a/app/helpers/check_errors_helper.rb +++ b/app/helpers/check_errors_helper.rb @@ -2,7 +2,7 @@ module CheckErrorsHelper include GovukLinkHelper def check_errors_answer_text(question, log) - question.displayed_as_answered?(log) ? "Change" : "Answer" + question.displayed_as_answered?(log) ? "Change" : "" end def check_errors_answer_link(log, question, page, applicable_questions) diff --git a/app/views/form/check_errors.html.erb b/app/views/form/check_errors.html.erb index df297b891..c7b08701d 100644 --- a/app/views/form/check_errors.html.erb +++ b/app/views/form/check_errors.html.erb @@ -50,7 +50,7 @@
<% if !question.displayed_as_answered?(@log) || question.subsection.id == "setup" %> - <%= govuk_link_to check_errors_answer_text(question, @log), check_errors_answer_link(@log, question, @page, applicable_questions) %> + <%= govuk_link_to check_errors_answer_text(question, @log), check_errors_answer_link(@log, question, @page, applicable_questions) unless question.unanswered?(@log) %> <% else %> <% end %> diff --git a/spec/requests/check_errors_controller_spec.rb b/spec/requests/check_errors_controller_spec.rb index 71a83a3fa..186bb8749 100644 --- a/spec/requests/check_errors_controller_spec.rb +++ b/spec/requests/check_errors_controller_spec.rb @@ -295,7 +295,7 @@ RSpec.describe CheckErrorsController, type: :request do it "displays correct clear links" do expect(page).to have_content("Make sure these answers are correct") expect(page).to have_link(lettings_log.form.get_question("hhmemb", lettings_log).check_answer_prompt, href: "/lettings-logs/#{lettings_log.id}/household-members?referrer=check_answers_new_answer", class: "govuk-link govuk-link--no-visited-state") - expect(page).to have_link("Answer") + expect(page).to have_link("Enter total number of household members") expect(lettings_log.reload.earnings).to eq(nil) end end @@ -350,7 +350,7 @@ RSpec.describe CheckErrorsController, type: :request do it "displays correct clear links" do expect(page).to have_content("Make sure these answers are correct") expect(page).to have_link(sales_log.form.get_question("income1", sales_log).check_answer_prompt, href: "/sales-logs/#{sales_log.id}/buyer-1-income?referrer=check_answers_new_answer", class: "govuk-link govuk-link--no-visited-state") - expect(page).to have_link("Answer") + expect(page).to have_link("Enter buyer 1’s gross annual income") expect(sales_log.reload.income1).to eq(nil) end end