Browse Source

CLDC-4402: remove now-dead pre-2024 uprn/address/relet lettings pages

CLDC-4402-audit-start-year-2024-or-later-usage-2
Rebecca Jesson 4 weeks ago
parent
commit
55e77fde86
  1. 12
      app/models/form/lettings/pages/property_number_of_times_relet.rb
  2. 15
      app/models/form/lettings/questions/offered.rb
  3. 5
      app/models/form/lettings/subsections/property_information.rb
  4. 20
      config/locales/forms/2024/lettings/property_information.en.yml
  5. 32
      spec/models/form/lettings/pages/property_number_of_times_relet_spec.rb
  6. 32
      spec/models/form/lettings/questions/offered_spec.rb

12
app/models/form/lettings/pages/property_number_of_times_relet.rb

@ -1,12 +0,0 @@
class Form::Lettings::Pages::PropertyNumberOfTimesRelet < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "property_number_of_times_relet"
@depends_on = [{ "first_time_property_let_as_social_housing" => 0, "is_renewal?" => false },
{ "first_time_property_let_as_social_housing" => 1, "is_renewal?" => false }]
end
def questions
@questions ||= [Form::Lettings::Questions::Offered.new(nil, nil, self)]
end
end

15
app/models/form/lettings/questions/offered.rb

@ -1,15 +0,0 @@
class Form::Lettings::Questions::Offered < ::Form::Question
def initialize(id, hsh, page)
super
@id = "offered"
@type = "numeric"
@width = 2
@check_answers_card_number = 0
@max = 150
@min = 0
@step = 1
@question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
QUESTION_NUMBER_FROM_YEAR = { 2023 => 18, 2024 => 18, 2025 => 18, 2026 => 18 }.freeze
end

5
app/models/form/lettings/subsections/property_information.rb

@ -13,7 +13,6 @@ class Form::Lettings::Subsections::PropertyInformation < ::Form::Subsection
Form::Lettings::Pages::PropertyLocalAuthority.new(nil, nil, self), Form::Lettings::Pages::PropertyLocalAuthority.new(nil, nil, self),
Form::Lettings::Pages::RentValueCheck.new("local_authority_rent_value_check", nil, self), Form::Lettings::Pages::RentValueCheck.new("local_authority_rent_value_check", nil, self),
(first_let_questions unless form.start_year_2025_or_later?), (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::PropertyUnitType.new(nil, nil, self),
(Form::Lettings::Pages::PropertyBuildingType.new(nil, nil, self) unless form.start_year_2026_or_later?), (Form::Lettings::Pages::PropertyBuildingType.new(nil, nil, self) unless form.start_year_2026_or_later?),
Form::Lettings::Pages::PropertyWheelchairAccessible.new(nil, nil, self), Form::Lettings::Pages::PropertyWheelchairAccessible.new(nil, nil, self),
@ -42,10 +41,6 @@ class Form::Lettings::Subsections::PropertyInformation < ::Form::Subsection
end end
end end
def number_of_times_relet
Form::Lettings::Pages::PropertyNumberOfTimesRelet.new(nil, nil, self) unless form.start_year_2024_or_later?
end
def first_let_questions def first_let_questions
[ [
Form::Lettings::Pages::FirstTimePropertyLetAsSocialHousing.new(nil, nil, self), Form::Lettings::Pages::FirstTimePropertyLetAsSocialHousing.new(nil, nil, self),

20
config/locales/forms/2024/lettings/property_information.en.yml

@ -10,26 +10,6 @@ en:
hint_text: "" hint_text: ""
question_text: "Is this the first time the property has been let as social housing?" question_text: "Is this the first time the property has been let as social housing?"
uprn:
page_header: ""
uprn_known:
check_answer_label: "UPRN known"
check_answer_prompt: "Enter UPRN if known"
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 don’t know the UPRN you can enter the address of the property instead on the next screen."
question_text: "Do you know the property’s UPRN?"
uprn:
check_answer_label: "UPRN"
check_answer_prompt: ""
hint_text: ""
question_text: "What is the property’s UPRN?"
uprn_confirmed:
page_header: "We found an address that might be this property"
check_answer_label: "Is this the right address?"
check_answer_prompt: "Tell us if this is the right address"
hint_text: ""
question_text: "Is this the property address?"
address_matcher: address_matcher:
page_header: "Find an address" page_header: "Find an address"
address_line1_input: address_line1_input:

32
spec/models/form/lettings/pages/property_number_of_times_relet_spec.rb

@ -1,32 +0,0 @@
require "rails_helper"
RSpec.describe Form::Lettings::Pages::PropertyNumberOfTimesRelet, type: :model do
subject(:page) { described_class.new(page_id, page_definition, subsection) }
let(:page_id) { nil }
let(:page_definition) { nil }
let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2024, 4, 1))) }
it "has correct subsection" do
expect(page.subsection).to eq(subsection)
end
it "has correct questions" do
expect(page.questions.map(&:id)).to eq(%w[offered])
end
it "has the correct id" do
expect(page.id).to eq("property_number_of_times_relet")
end
it "has the correct description" do
expect(page.description).to be_nil
end
it "has correct depends_on" do
expect(page.depends_on).to eq(
[{ "first_time_property_let_as_social_housing" => 0, "is_renewal?" => false },
{ "first_time_property_let_as_social_housing" => 1, "is_renewal?" => false }],
)
end
end

32
spec/models/form/lettings/questions/offered_spec.rb

@ -1,32 +0,0 @@
require "rails_helper"
RSpec.describe Form::Lettings::Questions::Offered, type: :model do
subject(:question) { described_class.new(nil, nil, page) }
let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1)))) }
it "has correct page" do
expect(question.page).to be page
end
it "has the correct id" do
expect(question.id).to eq "offered"
end
it "has the correct type" do
expect(question.type).to eq "numeric"
end
it "has the correct minimum and maximum values" do
expect(question.min).to be 0
expect(question.max).to be 150
end
it "has the correct step" do
expect(question.step).to be 1
end
it "is not marked as derived" do
expect(question.derived?(nil)).to be false
end
end
Loading…
Cancel
Save