From 865cdabf7a0bd34c3e81beeba110dfc8cfc5a80f Mon Sep 17 00:00:00 2001 From: Manny Dinssa <44172848+Dinssa@users.noreply.github.com> Date: Thu, 17 Apr 2025 15:07:44 +0100 Subject: [PATCH 1/2] CLDC-3971: Bug Q30 - Add error msg for hhmemb in shared housing scenario (#3034) * Add validation error for hhmemb in shared housing scenario * Update hhmemb validation message for shared housing scenario --- app/models/validations/property_validations.rb | 4 ++-- .../locales/validations/lettings/property_information.en.yml | 4 +++- spec/models/validations/property_validations_spec.rb | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/models/validations/property_validations.rb b/app/models/validations/property_validations.rb index 364cfe732..4b34d2d3c 100644 --- a/app/models/validations/property_validations.rb +++ b/app/models/validations/property_validations.rb @@ -22,10 +22,10 @@ module Validations::PropertyValidations def validate_shared_housing_rooms(record) return unless record.unittype_gn - if record.hhmemb == 1 && record.is_shared_housing? && - !record.beds.to_i.between?(1, 3) && record.beds.present? + if record.hhmemb == 1 && record.is_shared_housing? && !record.beds.to_i.between?(1, 3) && record.beds.present? record.errors.add :unittype_gn, I18n.t("validations.lettings.property.unittype_gn.one_three_bedroom_single_tenant_shared") record.errors.add :beds, :one_three_bedroom_single_tenant_shared, message: I18n.t("validations.lettings.property.beds.one_three_bedroom_single_tenant_shared") + record.errors.add :hhmemb, I18n.t("validations.lettings.property.hhmemb.one_three_bedroom_single_tenant_shared") elsif record.is_shared_housing? && record.beds.present? && !record.beds.to_i.between?(1, 7) record.errors.add :unittype_gn, I18n.t("validations.lettings.property.unittype_gn.one_seven_bedroom_shared") record.errors.add :beds, I18n.t("validations.lettings.property.beds.one_seven_bedroom_shared") diff --git a/config/locales/validations/lettings/property_information.en.yml b/config/locales/validations/lettings/property_information.en.yml index 091e89664..20fdcba94 100644 --- a/config/locales/validations/lettings/property_information.en.yml +++ b/config/locales/validations/lettings/property_information.en.yml @@ -17,6 +17,8 @@ en: beds: one_three_bedroom_single_tenant_shared: "A shared house with fewer than two tenants must have 1 to 3 bedrooms." one_seven_bedroom_shared: "A shared house must have 1 to 7 bedrooms." + hhmemb: + one_three_bedroom_single_tenant_shared: "A shared house with more than 3 bedrooms cannot have fewer than two tenants." uprn: invalid: "UPRN must be 12 digits or less." not_in_england: "It looks like you have entered an address outside of England. Only create logs for lettings in England." @@ -30,7 +32,7 @@ en: not_in_england: "This scheme’s only location is outside of England. Only create logs for lettings in England." location_id: not_in_england: "It looks like you have selected a location outside of England. Only create logs for lettings in England." - startdate: + startdate: postcode_not_in_england: "It looks like you have an entered a postcode outside of England. Only create logs for lettings in England." address_not_in_england: "It looks like you have entered an address outside of England. Only create logs for lettings in England." location_not_in_england: "It looks like you have selected a location outside of England. Only create logs for lettings in England." diff --git a/spec/models/validations/property_validations_spec.rb b/spec/models/validations/property_validations_spec.rb index 88939959b..f4e5fe6f2 100644 --- a/spec/models/validations/property_validations_spec.rb +++ b/spec/models/validations/property_validations_spec.rb @@ -85,6 +85,7 @@ RSpec.describe Validations::PropertyValidations do property_validator.validate_shared_housing_rooms(log) expect(log.errors["unittype_gn"]).to include(match(expected_error)) expect(log.errors["beds"]).to include(I18n.t("validations.lettings.property.unittype_gn.one_three_bedroom_single_tenant_shared")) + expect(log.errors["hhmemb"]).to include(I18n.t("validations.lettings.property.hhmemb.one_three_bedroom_single_tenant_shared")) end end end From ea0f5066372dfa04de548d5b14db8b1e7307cedf Mon Sep 17 00:00:00 2001 From: Manny Dinssa <44172848+Dinssa@users.noreply.github.com> Date: Thu, 17 Apr 2025 15:08:02 +0100 Subject: [PATCH 2/2] Add referral_type to derived_values in lettings_log_variables when renewal (#3038) --- app/models/derived_variables/lettings_log_variables.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/derived_variables/lettings_log_variables.rb b/app/models/derived_variables/lettings_log_variables.rb index 195b187de..4666a47ae 100644 --- a/app/models/derived_variables/lettings_log_variables.rb +++ b/app/models/derived_variables/lettings_log_variables.rb @@ -181,6 +181,7 @@ private }, derived_values: { referral: 1, + referral_type: 3, waityear: 2, offered: 0, rsnvac: 14,