From 7e00e1192d4143300a1be13da0cf0b134aaa90e8 Mon Sep 17 00:00:00 2001 From: Kat Date: Thu, 18 May 2023 11:34:50 +0100 Subject: [PATCH] Remove soft validations from lettings setup and make them mandatory --- app/models/form/lettings/subsections/setup.rb | 8 -------- app/models/lettings_log.rb | 2 +- .../form/lettings/subsections/setup_spec.rb | 16 ---------------- 3 files changed, 1 insertion(+), 25 deletions(-) diff --git a/app/models/form/lettings/subsections/setup.rb b/app/models/form/lettings/subsections/setup.rb index f8514007c..3b833927d 100644 --- a/app/models/form/lettings/subsections/setup.rb +++ b/app/models/form/lettings/subsections/setup.rb @@ -9,22 +9,14 @@ class Form::Lettings::Subsections::Setup < ::Form::Subsection def pages @pages ||= [ Form::Lettings::Pages::StockOwner.new(nil, nil, self), - Form::Lettings::Pages::MinRentValueCheck.new("stock_owner_min_rent_value_check", nil, self), - Form::Lettings::Pages::MaxRentValueCheck.new("stock_owner_max_rent_value_check", nil, self), Form::Lettings::Pages::ManagingOrganisation.new(nil, nil, self), Form::Lettings::Pages::CreatedBy.new(nil, nil, self), Form::Lettings::Pages::NeedsType.new(nil, nil, self), Form::Lettings::Pages::Scheme.new(nil, nil, self), Form::Lettings::Pages::Location.new(nil, nil, self), - Form::Lettings::Pages::MinRentValueCheck.new("needs_type_min_rent_value_check", nil, self), - Form::Lettings::Pages::MaxRentValueCheck.new("needs_type_max_rent_value_check", nil, self), Form::Lettings::Pages::Renewal.new(nil, nil, self), Form::Lettings::Pages::TenancyStartDate.new(nil, nil, self), - Form::Lettings::Pages::MinRentValueCheck.new("start_date_min_rent_value_check", nil, self), - Form::Lettings::Pages::MaxRentValueCheck.new("start_date_max_rent_value_check", nil, self), Form::Lettings::Pages::RentType.new(nil, nil, self), - Form::Lettings::Pages::MinRentValueCheck.new("rent_type_min_rent_value_check", nil, self), - Form::Lettings::Pages::MaxRentValueCheck.new("rent_type_max_rent_value_check", nil, self), Form::Lettings::Pages::TenantCode.new(nil, nil, self), Form::Lettings::Pages::PropertyReference.new(nil, nil, self), ].compact diff --git a/app/models/lettings_log.rb b/app/models/lettings_log.rb index c1a3e4a16..b1de54bbf 100644 --- a/app/models/lettings_log.rb +++ b/app/models/lettings_log.rb @@ -55,7 +55,7 @@ class LettingsLog < Log scope :filter_by_organisation, ->(org, _user = nil) { where(owning_organisation: org).or(where(managing_organisation: org)) } AUTOGENERATED_FIELDS = %w[id status created_at updated_at discarded_at].freeze - OPTIONAL_FIELDS = %w[rent_value_check first_time_property_let_as_social_housing tenancycode propcode chcharge].freeze + OPTIONAL_FIELDS = %w[first_time_property_let_as_social_housing tenancycode propcode chcharge].freeze RENT_TYPE_MAPPING_LABELS = { 1 => "Social Rent", 2 => "Affordable Rent", 3 => "Intermediate Rent" }.freeze HAS_BENEFITS_OPTIONS = [1, 6, 8, 7].freeze NUM_OF_WEEKS_FROM_PERIOD = { 2 => 26, 3 => 13, 4 => 12, 5 => 50, 6 => 49, 7 => 48, 8 => 47, 9 => 46, 1 => 52, 10 => 53 }.freeze diff --git a/spec/models/form/lettings/subsections/setup_spec.rb b/spec/models/form/lettings/subsections/setup_spec.rb index 00f9b5904..d7da750a8 100644 --- a/spec/models/form/lettings/subsections/setup_spec.rb +++ b/spec/models/form/lettings/subsections/setup_spec.rb @@ -15,22 +15,14 @@ RSpec.describe Form::Lettings::Subsections::Setup, type: :model do expect(setup.pages.map(&:id)).to eq( %w[ stock_owner - stock_owner_min_rent_value_check - stock_owner_max_rent_value_check managing_organisation created_by needs_type scheme location - needs_type_min_rent_value_check - needs_type_max_rent_value_check renewal tenancy_start_date - start_date_min_rent_value_check - start_date_max_rent_value_check rent_type - rent_type_min_rent_value_check - rent_type_max_rent_value_check tenant_code property_reference ], @@ -50,22 +42,14 @@ RSpec.describe Form::Lettings::Subsections::Setup, type: :model do expect(setup.pages.map(&:id)).to eq( %w[ stock_owner - stock_owner_min_rent_value_check - stock_owner_max_rent_value_check managing_organisation created_by needs_type scheme location - needs_type_min_rent_value_check - needs_type_max_rent_value_check renewal tenancy_start_date - start_date_min_rent_value_check - start_date_max_rent_value_check rent_type - rent_type_min_rent_value_check - rent_type_max_rent_value_check tenant_code property_reference ],