Browse Source

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
pull/2171/head
Rachael Booth 11 months ago committed by GitHub
parent
commit
c83bd18c42
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 5
      app/models/form/lettings/questions/uprn_known.rb
  2. 5
      app/models/form/sales/questions/uprn_known.rb
  3. 44
      app/models/form/sales/subsections/property_information.rb
  4. 5
      spec/models/form/lettings/questions/uprn_known_spec.rb
  5. 5
      spec/models/form/sales/questions/uprn_known_spec.rb
  6. 26
      spec/models/form/sales/subsections/property_information_spec.rb

5
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.<br><br>
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.<br><br>
The UPRN may not be the same as the property reference assigned by your organisation.<br><br>
If you dont know the UPRN you can enter the address of the property instead on the next screen."
@conditional_for = { "uprn" => [1] }
@inferred_check_answers_value = [
{

5
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.<br><br>
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.<br><br>
The UPRN may not be the same as the property reference assigned by your organisation.<br><br>
If you dont know the UPRN you can enter the address of the property instead on the next screen."
@conditional_for = { "uprn" => [1] }
@inferred_check_answers_value = [
{

44
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

5
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.<br><br>
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.<br><br>
The UPRN may not be the same as the property reference assigned by your organisation.<br><br>
If you dont know the UPRN you can enter the address of the property instead on the next screen.",
)
end

5
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.<br><br>
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.<br><br>
The UPRN may not be the same as the property reference assigned by your organisation.<br><br>
If you dont know the UPRN you can enter the address of the property instead on the next screen.",
)
end

26
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

Loading…
Cancel
Save