diff --git a/app/models/lettings_log.rb b/app/models/lettings_log.rb index 27d9b0d21..bb154ad2a 100644 --- a/app/models/lettings_log.rb +++ b/app/models/lettings_log.rb @@ -436,7 +436,7 @@ class LettingsLog < Log end def soft_min_for_period - beds = needstype == 2 ? 0 : self.beds + beds = needstype == 2 ? 0 : [self.beds, 4].min la = needstype == 2 ? Location.find(location_id).location_code : self.la soft_min = LaRentRange.find_by(start_year: collection_start_year, la:, beds:, lettype:).soft_min @@ -444,7 +444,7 @@ class LettingsLog < Log end def soft_max_for_period - beds = needstype == 2 ? 0 : self.beds + beds = needstype == 2 ? 0 : [self.beds, 4].min la = needstype == 2 ? Location.find(location_id).location_code : self.la soft_max = LaRentRange.find_by(start_year: collection_start_year, la:, beds:, lettype:).soft_max diff --git a/app/models/validations/financial_validations.rb b/app/models/validations/financial_validations.rb index 6c18260ae..0956c9224 100644 --- a/app/models/validations/financial_validations.rb +++ b/app/models/validations/financial_validations.rb @@ -182,7 +182,7 @@ private collection_year = record.collection_start_year - beds = record.needstype == 2 ? 0 : record.beds + beds = record.needstype == 2 ? 0 : [record.beds, 4].min la = record.needstype == 2 ? Location.find(record.location_id).location_code : record.la rent_range = LaRentRange.find_by(start_year: collection_year, la:, beds:, lettype: record.lettype) diff --git a/app/models/validations/soft_validations.rb b/app/models/validations/soft_validations.rb index 7a9635fd2..d8730150d 100644 --- a/app/models/validations/soft_validations.rb +++ b/app/models/validations/soft_validations.rb @@ -28,7 +28,7 @@ module Validations::SoftValidations def rent_in_soft_min_range? return unless brent && weekly_value(brent) && startdate - beds = needstype == 2 ? 0 : self.beds + beds = needstype == 2 ? 0 : [self.beds, 4].min la = needstype == 2 ? Location.find(location_id).location_code : self.la rent_range = LaRentRange.find_by(start_year: collection_start_year, la:, beds:, lettype: get_lettype) @@ -38,7 +38,7 @@ module Validations::SoftValidations def rent_in_soft_max_range? return unless brent && weekly_value(brent) && startdate - beds = needstype == 2 ? 0 : self.beds + beds = needstype == 2 ? 0 : [self.beds, 4].min la = needstype == 2 ? Location.find(location_id).location_code : self.la rent_range = LaRentRange.find_by(start_year: collection_start_year, la:, beds:, lettype: get_lettype)