diff --git a/app/models/form/lettings/subsections/property_information.rb b/app/models/form/lettings/subsections/property_information.rb index 2e21b8c5a..9cc77a723 100644 --- a/app/models/form/lettings/subsections/property_information.rb +++ b/app/models/form/lettings/subsections/property_information.rb @@ -10,6 +10,8 @@ class Form::Lettings::Subsections::PropertyInformation < ::Form::Subsection @pages ||= [ uprn_questions, Form::Lettings::Pages::PropertyLocalAuthority.new(nil, nil, self), + Form::Lettings::Pages::MinRentValueCheck.new(nil, nil, self), + Form::Lettings::Pages::MaxRentValueCheck.new(nil, nil, self), Form::Lettings::Pages::FirstTimePropertyLetAsSocialHousing.new(nil, nil, self), Form::Lettings::Pages::PropertyLetType.new(nil, nil, self), Form::Lettings::Pages::PropertyVacancyReasonNotFirstLet.new(nil, nil, self), @@ -20,6 +22,8 @@ class Form::Lettings::Subsections::PropertyInformation < ::Form::Subsection Form::Lettings::Pages::PropertyBuildingType.new(nil, nil, self), Form::Lettings::Pages::PropertyWheelchairAccessible.new(nil, nil, self), Form::Lettings::Pages::PropertyNumberOfBedrooms.new(nil, nil, self), + Form::Lettings::Pages::MinRentValueCheck.new(nil, nil, self), + Form::Lettings::Pages::MaxRentValueCheck.new(nil, nil, self), Form::Lettings::Pages::VoidDate.new(nil, nil, self), Form::Lettings::Pages::VoidDateValueCheck.new(nil, nil, self), Form::Lettings::Pages::PropertyMajorRepairs.new(nil, nil, self), diff --git a/app/models/lettings_log.rb b/app/models/lettings_log.rb index 0ddc921be..99d40fb04 100644 --- a/app/models/lettings_log.rb +++ b/app/models/lettings_log.rb @@ -435,12 +435,22 @@ class LettingsLog < Log end def soft_min_for_period - soft_min = LaRentRange.find_by(start_year: collection_start_year, la:, beds: beds_for_la_rent_range, lettype:).soft_min + soft_min = LaRentRange.find_by( + start_year: collection_start_year, + la:, + beds: beds_for_la_rent_range, + lettype:, + ).soft_min "#{soft_value_for_period(soft_min)} #{SUFFIX_FROM_PERIOD[period].presence || 'every week'}" end def soft_max_for_period - soft_max = LaRentRange.find_by(start_year: collection_start_year, la:, beds: beds_for_la_rent_range, lettype:).soft_max + soft_max = LaRentRange.find_by( + start_year: collection_start_year, + la:, + beds: beds_for_la_rent_range, + lettype:, + ).soft_max "#{soft_value_for_period(soft_max)} #{SUFFIX_FROM_PERIOD[period].presence || 'every week'}" end diff --git a/app/models/validations/soft_validations.rb b/app/models/validations/soft_validations.rb index cfcfb643b..5c571af6a 100644 --- a/app/models/validations/soft_validations.rb +++ b/app/models/validations/soft_validations.rb @@ -40,7 +40,12 @@ module Validations::SoftValidations def rent_in_soft_max_range? return unless brent && weekly_value(brent) && startdate - rent_range = LaRentRange.find_by(start_year: collection_start_year, la:, beds: beds_for_la_rent_range, lettype: get_lettype) + rent_range = LaRentRange.find_by( + start_year: collection_start_year, + la:, + beds: beds_for_la_rent_range, + lettype: get_lettype, + ) if beds.present? && rent_range.present? && beds > LaRentRange::MAX_BEDS weekly_value(brent) > rent_range.soft_max elsif rent_range.present?