From 011acfec822853f6fe7279308364d6f0704dbcc6 Mon Sep 17 00:00:00 2001 From: Kat <54268893+kosiakkatrina@users.noreply.github.com> Date: Thu, 20 Feb 2025 10:49:00 +0000 Subject: [PATCH] Move new build questions --- .../lettings/subsections/property_information.rb | 15 +++++++++++---- .../subsections/property_information_spec.rb | 8 ++++---- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/app/models/form/lettings/subsections/property_information.rb b/app/models/form/lettings/subsections/property_information.rb index 4d3e022c0..f20e97d75 100644 --- a/app/models/form/lettings/subsections/property_information.rb +++ b/app/models/form/lettings/subsections/property_information.rb @@ -8,13 +8,11 @@ class Form::Lettings::Subsections::PropertyInformation < ::Form::Subsection def pages @pages ||= [ + (first_let_questions if form.start_year_2025_or_later?), uprn_questions, Form::Lettings::Pages::PropertyLocalAuthority.new(nil, nil, self), Form::Lettings::Pages::RentValueCheck.new("local_authority_rent_value_check", nil, self, check_answers_card_number: nil), - Form::Lettings::Pages::FirstTimePropertyLetAsSocialHousing.new(nil, nil, self), - Form::Lettings::Pages::PropertyLetType.new(nil, nil, self), - Form::Lettings::Pages::PropertyVacancyReasonNotFirstLet.new(nil, nil, self), - Form::Lettings::Pages::PropertyVacancyReasonFirstLet.new(nil, nil, self), + (first_let_questions unless form.start_year_2025_or_later?), number_of_times_relet, Form::Lettings::Pages::PropertyUnitType.new(nil, nil, self), Form::Lettings::Pages::PropertyBuildingType.new(nil, nil, self), @@ -52,6 +50,15 @@ class Form::Lettings::Subsections::PropertyInformation < ::Form::Subsection Form::Lettings::Pages::PropertyNumberOfTimesRelet.new(nil, nil, self) unless form.start_year_2024_or_later? end + def first_let_questions + [ + Form::Lettings::Pages::FirstTimePropertyLetAsSocialHousing.new(nil, nil, self), + Form::Lettings::Pages::PropertyLetType.new(nil, nil, self), + Form::Lettings::Pages::PropertyVacancyReasonNotFirstLet.new(nil, nil, self), + Form::Lettings::Pages::PropertyVacancyReasonFirstLet.new(nil, nil, self), + ] + end + def displayed_in_tasklist?(log) !(log.is_supported_housing? && log.is_renewal?) end diff --git a/spec/models/form/lettings/subsections/property_information_spec.rb b/spec/models/form/lettings/subsections/property_information_spec.rb index 0d3a4e99b..e0e9a61ae 100644 --- a/spec/models/form/lettings/subsections/property_information_spec.rb +++ b/spec/models/form/lettings/subsections/property_information_spec.rb @@ -101,6 +101,10 @@ RSpec.describe Form::Lettings::Subsections::PropertyInformation, type: :model do it "has correct pages" do expect(property_information.pages.map(&:id)).to eq( %w[ + first_time_property_let_as_social_housing + property_let_type + property_vacancy_reason_not_first_let + property_vacancy_reason_first_let uprn uprn_confirmation address_matcher @@ -109,10 +113,6 @@ RSpec.describe Form::Lettings::Subsections::PropertyInformation, type: :model do address property_local_authority local_authority_rent_value_check - first_time_property_let_as_social_housing - property_let_type - property_vacancy_reason_not_first_let - property_vacancy_reason_first_let property_unit_type property_building_type property_wheelchair_accessible