Browse Source

CLDC-3735: Sales - Move Q19 (What type of unit is the property?) (25/26) (#2760)

pull/2766/head^2
Manny Dinssa 2 months ago committed by GitHub
parent
commit
30442fcee2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      app/models/derived_variables/sales_log_variables.rb
  2. 1
      app/models/form/sales/pages/property_number_of_bedrooms.rb
  3. 3
      app/models/form/sales/subsections/property_information.rb
  4. 4
      app/models/sales_log.rb
  5. 2
      config/locales/forms/2025/sales/property_information.en.yml
  6. 36
      spec/models/form/sales/subsections/property_information_spec.rb

4
app/models/derived_variables/sales_log_variables.rb

@ -68,6 +68,10 @@ module DerivedVariables::SalesLogVariables
self.la = nil
end
if form.start_year_2025_or_later? && is_bedsit?
self.beds = 1
end
self.nationality_all = nationality_all_group if nationality_uk_or_prefers_not_to_say?
self.nationality_all_buyer2 = nationality_all_buyer2_group if nationality2_uk_or_prefers_not_to_say?

1
app/models/form/sales/pages/property_number_of_bedrooms.rb

@ -2,6 +2,7 @@ class Form::Sales::Pages::PropertyNumberOfBedrooms < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "property_number_of_bedrooms"
@depends_on = [{ "is_beds_inferred?" => false }]
end
def questions

3
app/models/form/sales/subsections/property_information.rb

@ -9,9 +9,10 @@ class Form::Sales::Subsections::PropertyInformation < ::Form::Subsection
def pages
@pages ||= [
(uprn_questions if form.start_date.year >= 2024),
(Form::Sales::Pages::PropertyUnitType.new(nil, nil, self) if form.start_year_2025_or_later?),
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::PropertyUnitType.new(nil, nil, self) unless form.start_year_2025_or_later?),
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),

4
app/models/sales_log.rb

@ -396,6 +396,10 @@ class SalesLog < Log
proptype == 2
end
def is_beds_inferred?
form.start_year_2025_or_later? && is_bedsit?
end
def shared_ownership_scheme?
ownershipsch == 1
end

2
config/locales/forms/2025/sales/property_information.en.yml

@ -69,7 +69,7 @@ en:
beds:
page_header: ""
check_answer_label: "Number of bedrooms"
hint_text: "A bedsit has 1 bedroom."
hint_text: ""
question_text: "How many bedrooms does the property have?"
proptype:

36
spec/models/form/sales/subsections/property_information_spec.rb

@ -15,6 +15,7 @@ RSpec.describe Form::Sales::Subsections::PropertyInformation, type: :model do
before do
allow(form).to receive(:start_year_2024_or_later?).and_return(false)
allow(form).to receive(:start_year_2025_or_later?).and_return(false)
end
context "when 2023" do
@ -48,6 +49,7 @@ RSpec.describe Form::Sales::Subsections::PropertyInformation, type: :model do
before do
allow(form).to receive(:start_year_2024_or_later?).and_return(true)
allow(form).to receive(:start_year_2025_or_later?).and_return(false)
end
it "has correct pages" do
@ -75,6 +77,40 @@ RSpec.describe Form::Sales::Subsections::PropertyInformation, type: :model do
)
end
end
context "when 2025" do
let(:start_date) { Time.utc(2025, 2, 8) }
before do
allow(form).to receive(:start_year_2024_or_later?).and_return(true)
allow(form).to receive(:start_year_2025_or_later?).and_return(true)
end
it "has correct pages" do
expect(property_information.pages.map(&:id)).to eq(
%w[
uprn
uprn_confirmation
address_matcher
no_address_found
uprn_selection
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_unit_type
property_number_of_bedrooms
about_price_bedrooms_value_check
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