From 0ec1f25af5c45aa845c73dc89b64fd84663914ec Mon Sep 17 00:00:00 2001 From: Rachael Booth Date: Wed, 24 Jan 2024 09:55:24 +0000 Subject: [PATCH] CLDC-3129: Move sales UPRN questions to start of property information section for 2024 --- .../sales/subsections/property_information.rb | 6 +++-- .../subsections/property_information_spec.rb | 26 +++++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/app/models/form/sales/subsections/property_information.rb b/app/models/form/sales/subsections/property_information.rb index 6d6a49564..f39a29d96 100644 --- a/app/models/form/sales/subsections/property_information.rb +++ b/app/models/form/sales/subsections/property_information.rb @@ -8,15 +8,15 @@ 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, + (uprn_questions if form.start_date.year < 2024), postcode_and_la_questions, - Form::Sales::Pages::AboutPriceValueCheck.new("about_price_la_value_check", nil, self), Form::Sales::Pages::PropertyWheelchairAccessible.new(nil, nil, self), ].flatten.compact end @@ -31,6 +31,7 @@ class Form::Sales::Subsections::PropertyInformation < ::Form::Subsection 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 @@ -43,6 +44,7 @@ class Form::Sales::Subsections::PropertyInformation < ::Form::Subsection 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/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