From fd2ab8672327ffcf276c94583634795f919ac9a8 Mon Sep 17 00:00:00 2001 From: Paul Robert Lloyd Date: Thu, 17 Feb 2022 15:14:38 +0000 Subject: [PATCH] Update case log constants to match JSON form config --- app/models/constants/case_log.rb | 22 +++++++++---------- .../validations/household_validations.rb | 2 +- .../local_authority_validations.rb | 2 +- .../validations/property_validations.rb | 4 ++-- config/forms/2021_2022.json | 18 +++++++-------- .../validations/property_validations_spec.rb | 6 ++--- 6 files changed, 27 insertions(+), 27 deletions(-) diff --git a/app/models/constants/case_log.rb b/app/models/constants/case_log.rb index 229193c36..c429ffa0e 100644 --- a/app/models/constants/case_log.rb +++ b/app/models/constants/case_log.rb @@ -164,20 +164,20 @@ module Constants::CaseLog }.freeze RSNVAC = { - "First let of new-build property" => 15, - "First let of conversion, rehabilitation or acquired property" => 16, - "First let of leased property" => 17, - "Tenant evicted due to arrears" => 10, - "Tenant evicted due to ASB or other reason" => 11, - "Previous tenant passed away (no succession)" => 5, - "Tenant moved to other social housing provider" => 12, - "Tenant abandoned property" => 6, - "Tenant moved to private sector or other accommodation" => 8, - "Relet to tenant who occupied same property as temporary accommodation" => 9, "Internal transfer (excluding renewals of a fixed-term tenancy)" => 13, + "Previous tenant died with no succession" => 5, + "Re-let to tenant who occupied same property as temporary accommodation" => 9, "Renewal of fixed-term tenancy" => 14, - "Tenant moved to care home" => 18, "Tenant involved in a succession downsize" => 19, + "Tenant abandoned property" => 6, + "Tenant moved to care home" => 18, + "Tenant moved to other social housing provider" => 12, + "Tenant moved to private sector or other accommodation" => 8, + "Tenant was evicted due to anti-social behaviour" => 11, + "Tenant was evicted due to rent arrears" => 10, + "First let of new-build property" => 15, + "First let of conversion, rehabilitation or acquired property" => 16, + "First let of leased property" => 17, }.freeze UNITTYPE_GN = { diff --git a/app/models/validations/household_validations.rb b/app/models/validations/household_validations.rb index cdc316ff6..41ece6c69 100644 --- a/app/models/validations/household_validations.rb +++ b/app/models/validations/household_validations.rb @@ -68,7 +68,7 @@ module Validations::HouseholdValidations end def validate_previous_housing_situation(record) - if record.rsnvac == "Relet to tenant who occupied same property as temporary accommodation" && NON_TEMP_ACCOMMODATION.include?(record.prevten) + if record.rsnvac == "Re-let to tenant who occupied same property as temporary accommodation" && NON_TEMP_ACCOMMODATION.include?(record.prevten) record.errors.add :prevten, I18n.t("validations.household.prevten.non_temp_accommodation") end end diff --git a/app/models/validations/local_authority_validations.rb b/app/models/validations/local_authority_validations.rb index 2b00c52e5..c8e8c5557 100644 --- a/app/models/validations/local_authority_validations.rb +++ b/app/models/validations/local_authority_validations.rb @@ -11,7 +11,7 @@ module Validations::LocalAuthorityValidations end def validate_referral(record) - if record.rsnvac == "Relet to tenant who occupied same property as temporary accommodation" && REFERRAL_INVALID_TMP.include?(record.referral) + if record.rsnvac == "Re-let to tenant who occupied same property as temporary accommodation" && REFERRAL_INVALID_TMP.include?(record.referral) record.errors.add :referral, I18n.t("validations.local_authority.referral.rsnvac_non_temp") end end diff --git a/app/models/validations/property_validations.rb b/app/models/validations/property_validations.rb index b6eccd38c..ef09a56e2 100644 --- a/app/models/validations/property_validations.rb +++ b/app/models/validations/property_validations.rb @@ -41,11 +41,11 @@ module Validations::PropertyValidations record.errors.add :rsnvac, I18n.t("validations.property.rsnvac.first_let_social") end - if record.rsnvac == "Relet to tenant who occupied same property as temporary accommodation" && NON_TEMP_ACCOMMODATION.include?(record.prevten) + if record.rsnvac == "Re-let to tenant who occupied same property as temporary accommodation" && NON_TEMP_ACCOMMODATION.include?(record.prevten) record.errors.add :rsnvac, I18n.t("validations.property.rsnvac.non_temp_accommodation") end - if record.rsnvac == "Relet to tenant who occupied same property as temporary accommodation" && REFERRAL_INVALID_TMP.include?(record.referral) + if record.rsnvac == "Re-let to tenant who occupied same property as temporary accommodation" && REFERRAL_INVALID_TMP.include?(record.referral) record.errors.add :rsnvac, I18n.t("validations.property.rsnvac.referral_invalid") end end diff --git a/config/forms/2021_2022.json b/config/forms/2021_2022.json index 914ca78d6..cf5f04adf 100644 --- a/config/forms/2021_2022.json +++ b/config/forms/2021_2022.json @@ -667,26 +667,26 @@ "0": { "value": "Renewal of fixed-term tenancy" }, + "7": { + "value": "Tenant abandoned property" + }, "3": { "value": "Tenant involved in a succession downsize" }, - "4": { - "value": "Tenant moved to private sector or other accommodation" + "6": { + "value": "Tenant moved to care home" }, "5": { "value": "Tenant moved to other social housing provider" }, - "6": { - "value": "Tenant moved to care home" + "4": { + "value": "Tenant moved to private sector or other accommodation" }, - "7": { - "value": "Tenant abandoned property" + "9": { + "value": "Tenant was evicted due to anti-social behaviour" }, "8": { "value": "Tenant was evicted due to rent arrears" - }, - "9": { - "value": "Tenant was evicted due to anti-social behaviour" } } } diff --git a/spec/models/validations/property_validations_spec.rb b/spec/models/validations/property_validations_spec.rb index a223bfec9..7428c25dc 100644 --- a/spec/models/validations/property_validations_spec.rb +++ b/spec/models/validations/property_validations_spec.rb @@ -259,7 +259,7 @@ RSpec.describe Validations::PropertyValidations do it "validates that the property is not being relet to tenant who occupied as temporary" do non_temporary_previous_tenancies.each do |rsn| - record.rsnvac = "Relet to tenant who occupied same property as temporary accommodation" + record.rsnvac = "Re-let to tenant who occupied same property as temporary accommodation" record.prevten = rsn property_validator.validate_rsnvac(record) expect(record.errors["rsnvac"]) @@ -269,7 +269,7 @@ RSpec.describe Validations::PropertyValidations do it "validates that the letting source is not a referral" do referral_sources.each do |src| - record.rsnvac = "Relet to tenant who occupied same property as temporary accommodation" + record.rsnvac = "Re-let to tenant who occupied same property as temporary accommodation" record.referral = src property_validator.validate_rsnvac(record) expect(record.errors["rsnvac"]) @@ -281,7 +281,7 @@ RSpec.describe Validations::PropertyValidations do context "when the previous tenancy was temporary" do it "expects that the property can be relet to a tenant who previously occupied it as temporary" do record.prevten = "Fixed-term local authority general needs tenancy" - record.rsnvac = "Relet to tenant who occupied same property as temporary accommodation" + record.rsnvac = "Re-let to tenant who occupied same property as temporary accommodation" property_validator.validate_rsnvac(record) expect(record.errors["rsnvac"]).to be_empty end