From c83bd18c427e0d1c1a49a6ebb8cd6c55ec1a360a Mon Sep 17 00:00:00 2001 From: Rachael Booth Date: Thu, 25 Jan 2024 14:05:34 +0000 Subject: [PATCH] CLDC-3129: Update UPRN question (#2157) * CLDC-3129: Update UPRN known hint text * CLDC-3129: Move sales UPRN questions to start of property information section for 2024 * Refactor sales property information subsection for more clarity --- .../form/lettings/questions/uprn_known.rb | 5 ++- app/models/form/sales/questions/uprn_known.rb | 5 ++- .../sales/subsections/property_information.rb | 44 +++++++++---------- .../lettings/questions/uprn_known_spec.rb | 5 ++- .../form/sales/questions/uprn_known_spec.rb | 5 ++- .../subsections/property_information_spec.rb | 26 +++++++++++ 6 files changed, 59 insertions(+), 31 deletions(-) diff --git a/app/models/form/lettings/questions/uprn_known.rb b/app/models/form/lettings/questions/uprn_known.rb index 95c53ec6a..93daa1934 100644 --- a/app/models/form/lettings/questions/uprn_known.rb +++ b/app/models/form/lettings/questions/uprn_known.rb @@ -6,8 +6,9 @@ class Form::Lettings::Questions::UprnKnown < ::Form::Question @header = "Do you know the property's UPRN?" @type = "radio" @answer_options = ANSWER_OPTIONS - @hint_text = "The Unique Property Reference Number (UPRN) is a unique number system created by Ordnance Survey and used by housing providers and sectors UK-wide. For example 10010457355.

- You can continue without the UPRN, but it means we will need you to enter the address of the property." + @hint_text = "The Unique Property Reference Number (UPRN) is a unique number system created by Ordnance Survey and used by housing providers and various industries across the UK. An example UPRN is 10010457355.

+ The UPRN may not be the same as the property reference assigned by your organisation.

+ If you don’t know the UPRN you can enter the address of the property instead on the next screen." @conditional_for = { "uprn" => [1] } @inferred_check_answers_value = [ { diff --git a/app/models/form/sales/questions/uprn_known.rb b/app/models/form/sales/questions/uprn_known.rb index 09f3c54c9..f88629fe4 100644 --- a/app/models/form/sales/questions/uprn_known.rb +++ b/app/models/form/sales/questions/uprn_known.rb @@ -6,8 +6,9 @@ class Form::Sales::Questions::UprnKnown < ::Form::Question @header = "Do you know the property's UPRN?" @type = "radio" @answer_options = ANSWER_OPTIONS - @hint_text = "The Unique Property Reference Number (UPRN) is a unique number system created by Ordnance Survey and used by housing providers and sectors UK-wide. For example 10010457355.

- You can continue without the UPRN, but it means we will need you to enter the address of the property." + @hint_text = "The Unique Property Reference Number (UPRN) is a unique number system created by Ordnance Survey and used by housing providers and various industries across the UK. An example UPRN is 10010457355.

+ The UPRN may not be the same as the property reference assigned by your organisation.

+ If you don’t know the UPRN you can enter the address of the property instead on the next screen." @conditional_for = { "uprn" => [1] } @inferred_check_answers_value = [ { diff --git a/app/models/form/sales/subsections/property_information.rb b/app/models/form/sales/subsections/property_information.rb index 6d6a49564..302dfa7c7 100644 --- a/app/models/form/sales/subsections/property_information.rb +++ b/app/models/form/sales/subsections/property_information.rb @@ -8,42 +8,40 @@ class Form::Sales::Subsections::PropertyInformation < ::Form::Subsection def pages @pages ||= [ + (uprn_questions if form.start_date.year >= 2024), Form::Sales::Pages::PropertyNumberOfBedrooms.new(nil, nil, self), Form::Sales::Pages::AboutPriceValueCheck.new("about_price_bedrooms_value_check", nil, self), Form::Sales::Pages::PropertyUnitType.new(nil, nil, self), Form::Sales::Pages::MonthlyChargesValueCheck.new("monthly_charges_property_type_value_check", nil, self), Form::Sales::Pages::PercentageDiscountValueCheck.new("percentage_discount_proptype_value_check", nil, self), Form::Sales::Pages::PropertyBuildingType.new(nil, nil, self), - uprn_questions, - postcode_and_la_questions, - Form::Sales::Pages::AboutPriceValueCheck.new("about_price_la_value_check", nil, self), + (uprn_questions if form.start_date.year == 2023), + (postcode_and_la_questions if form.start_date.year < 2023), Form::Sales::Pages::PropertyWheelchairAccessible.new(nil, nil, self), ].flatten.compact end def uprn_questions - if form.start_date.year >= 2023 - [ - Form::Sales::Pages::Uprn.new(nil, nil, self), - Form::Sales::Pages::UprnConfirmation.new(nil, nil, self), - Form::Sales::Pages::Address.new(nil, nil, self), - Form::Sales::Pages::PropertyLocalAuthority.new(nil, nil, self), - Form::Sales::Pages::Buyer1IncomeMaxValueCheck.new("local_authority_buyer_1_income_max_value_check", nil, self, check_answers_card_number: nil), - Form::Sales::Pages::Buyer2IncomeMaxValueCheck.new("local_authority_buyer_2_income_max_value_check", nil, self, check_answers_card_number: nil), - Form::Sales::Pages::CombinedIncomeMaxValueCheck.new("local_authority_combined_income_max_value_check", nil, self, check_answers_card_number: nil), - ] - end + [ + Form::Sales::Pages::Uprn.new(nil, nil, self), + Form::Sales::Pages::UprnConfirmation.new(nil, nil, self), + Form::Sales::Pages::Address.new(nil, nil, self), + Form::Sales::Pages::PropertyLocalAuthority.new(nil, nil, self), + Form::Sales::Pages::Buyer1IncomeMaxValueCheck.new("local_authority_buyer_1_income_max_value_check", nil, self, check_answers_card_number: nil), + Form::Sales::Pages::Buyer2IncomeMaxValueCheck.new("local_authority_buyer_2_income_max_value_check", nil, self, check_answers_card_number: nil), + Form::Sales::Pages::CombinedIncomeMaxValueCheck.new("local_authority_combined_income_max_value_check", nil, self, check_answers_card_number: nil), + Form::Sales::Pages::AboutPriceValueCheck.new("about_price_la_value_check", nil, self), + ] end def postcode_and_la_questions - if form.start_date.year < 2023 - [ - Form::Sales::Pages::Postcode.new(nil, nil, self), - Form::Sales::Pages::PropertyLocalAuthority.new(nil, nil, self), - Form::Sales::Pages::Buyer1IncomeMaxValueCheck.new("local_authority_buyer_1_income_max_value_check", nil, self, check_answers_card_number: nil), - Form::Sales::Pages::Buyer2IncomeMaxValueCheck.new("local_authority_buyer_2_income_max_value_check", nil, self, check_answers_card_number: nil), - Form::Sales::Pages::CombinedIncomeMaxValueCheck.new("local_authority_combined_income_max_value_check", nil, self, check_answers_card_number: nil), - ] - end + [ + Form::Sales::Pages::Postcode.new(nil, nil, self), + Form::Sales::Pages::PropertyLocalAuthority.new(nil, nil, self), + Form::Sales::Pages::Buyer1IncomeMaxValueCheck.new("local_authority_buyer_1_income_max_value_check", nil, self, check_answers_card_number: nil), + Form::Sales::Pages::Buyer2IncomeMaxValueCheck.new("local_authority_buyer_2_income_max_value_check", nil, self, check_answers_card_number: nil), + Form::Sales::Pages::CombinedIncomeMaxValueCheck.new("local_authority_combined_income_max_value_check", nil, self, check_answers_card_number: nil), + Form::Sales::Pages::AboutPriceValueCheck.new("about_price_la_value_check", nil, self), + ] end end diff --git a/spec/models/form/lettings/questions/uprn_known_spec.rb b/spec/models/form/lettings/questions/uprn_known_spec.rb index b2c7f9d01..ec99a4fad 100644 --- a/spec/models/form/lettings/questions/uprn_known_spec.rb +++ b/spec/models/form/lettings/questions/uprn_known_spec.rb @@ -48,8 +48,9 @@ RSpec.describe Form::Lettings::Questions::UprnKnown, type: :model do it "has the correct hint" do expect(question.hint_text).to eq( - "The Unique Property Reference Number (UPRN) is a unique number system created by Ordnance Survey and used by housing providers and sectors UK-wide. For example 10010457355.

- You can continue without the UPRN, but it means we will need you to enter the address of the property.", + "The Unique Property Reference Number (UPRN) is a unique number system created by Ordnance Survey and used by housing providers and various industries across the UK. An example UPRN is 10010457355.

+ The UPRN may not be the same as the property reference assigned by your organisation.

+ If you don’t know the UPRN you can enter the address of the property instead on the next screen.", ) end diff --git a/spec/models/form/sales/questions/uprn_known_spec.rb b/spec/models/form/sales/questions/uprn_known_spec.rb index faac81698..9f5d4e604 100644 --- a/spec/models/form/sales/questions/uprn_known_spec.rb +++ b/spec/models/form/sales/questions/uprn_known_spec.rb @@ -48,8 +48,9 @@ RSpec.describe Form::Sales::Questions::UprnKnown, type: :model do it "has the correct hint" do expect(question.hint_text).to eq( - "The Unique Property Reference Number (UPRN) is a unique number system created by Ordnance Survey and used by housing providers and sectors UK-wide. For example 10010457355.

- You can continue without the UPRN, but it means we will need you to enter the address of the property.", + "The Unique Property Reference Number (UPRN) is a unique number system created by Ordnance Survey and used by housing providers and various industries across the UK. An example UPRN is 10010457355.

+ The UPRN may not be the same as the property reference assigned by your organisation.

+ If you don’t know the UPRN you can enter the address of the property instead on the next screen.", ) end diff --git a/spec/models/form/sales/subsections/property_information_spec.rb b/spec/models/form/sales/subsections/property_information_spec.rb index a916ceec1..8d3dce93d 100644 --- a/spec/models/form/sales/subsections/property_information_spec.rb +++ b/spec/models/form/sales/subsections/property_information_spec.rb @@ -63,6 +63,32 @@ RSpec.describe Form::Sales::Subsections::PropertyInformation, type: :model do ) end end + + context "when 2024" do + let(:start_date) { Time.utc(2024, 2, 8) } + + it "has correct pages" do + expect(property_information.pages.map(&:id)).to eq( + %w[ + uprn + uprn_confirmation + address + property_local_authority + local_authority_buyer_1_income_max_value_check + local_authority_buyer_2_income_max_value_check + local_authority_combined_income_max_value_check + about_price_la_value_check + property_number_of_bedrooms + about_price_bedrooms_value_check + property_unit_type + monthly_charges_property_type_value_check + percentage_discount_proptype_value_check + property_building_type + property_wheelchair_accessible + ], + ) + end + end end it "has the correct id" do