diff --git a/app/models/case_log.rb b/app/models/case_log.rb
index 5c82b93d5..252b6e360 100644
--- a/app/models/case_log.rb
+++ b/app/models/case_log.rb
@@ -320,6 +320,10 @@ class CaseLog < ApplicationRecord
hb == 7
end
+ def ethnic_refused?
+ ethnic_group == 17
+ end
+
def receives_housing_related_benefits?
receives_housing_benefit_only? || receives_uc_with_housing_element_excl_housing_benefit? ||
receives_housing_benefit_and_universal_credit?
@@ -435,6 +439,7 @@ private
self.totelder = get_totelder
self.totadult = get_totadult
self.refused = get_refused
+ self.ethnic = 17 if ethnic_refused?
if %i[brent scharge pscharge supcharg].any? { |f| public_send(f).present? }
self.brent ||= 0
self.scharge ||= 0
diff --git a/app/models/validations/household_validations.rb b/app/models/validations/household_validations.rb
index 5d0f52037..21944be2a 100644
--- a/app/models/validations/household_validations.rb
+++ b/app/models/validations/household_validations.rb
@@ -18,7 +18,7 @@ module Validations::HouseholdValidations
record.errors.add :underoccupation_benefitcap, I18n.t("validations.household.underoccupation_benefitcap.dont_know_required")
record.errors.add :reason, I18n.t("validations.household.underoccupation_benefitcap.dont_know_required")
end
- validate_other_field(record, 31, :reason, :reasonother)
+ validate_other_field(record, 20, :reason, :reasonother)
if record.is_reason_permanently_decanted? && record.referral.present? && !record.is_internal_transfer?
record.errors.add :referral, I18n.t("validations.household.referral.reason_permanently_decanted")
@@ -87,6 +87,22 @@ module Validations::HouseholdValidations
record.errors.add :sex1, I18n.t("validations.household.gender.male_refuge")
end
+ # 3 Private Sector Tenancy
+ # 4 Tied housing or rented with job
+ # 7 Direct access hostel
+ # 9 Residential care home
+ # 10 Hospital
+ # 13 Children's home / Foster Care
+ # 14 Bed and breakfast
+ # 19 Rough Sleeping
+ # 21 Refuge
+ # 23 Mobile home / Caravan
+ # 24 Home Office Asylum Support
+ # 25 Other
+ # 26 Owner Occupation
+ # 27 Owner occupation (low-cost home ownership)
+ # 28 Living with Friends or Family
+ # 29 Prison / Approved Probation Hostel
if record.is_internal_transfer? && [3, 4, 7, 9, 10, 13, 14, 19, 21, 23, 24, 25, 26, 27, 28, 29].include?(record.prevten)
label = record.form.get_question("prevten", record).present? ? record.form.get_question("prevten", record).label_from_value(record.prevten) : ""
record.errors.add :prevten, I18n.t("validations.household.prevten.internal_transfer", prevten: label)
diff --git a/app/services/imports/case_logs_import_service.rb b/app/services/imports/case_logs_import_service.rb
index ab0f41d71..be1605d86 100644
--- a/app/services/imports/case_logs_import_service.rb
+++ b/app/services/imports/case_logs_import_service.rb
@@ -201,7 +201,7 @@ module Imports
differences.push("#{key} #{value.inspect} #{case_log_value.inspect}")
end
end
- @logger.warn "Differences found when saving log #{case_log.id}: #{differences}" unless differences.empty?
+ @logger.warn "Differences found when saving log #{case_log.old_id}: #{differences}" unless differences.empty?
end
def check_status_completed(case_log, previous_status)
@@ -428,7 +428,7 @@ module Imports
4
when 17
# Refused
- 5
+ 17
end
end
diff --git a/spec/fixtures/softwire_imports/case_logs/0ead17cb-1668-442d-898c-0d52879ff592.xml b/spec/fixtures/softwire_imports/case_logs/0ead17cb-1668-442d-898c-0d52879ff592.xml
index 34ccc8e12..9bf6b5a87 100644
--- a/spec/fixtures/softwire_imports/case_logs/0ead17cb-1668-442d-898c-0d52879ff592.xml
+++ b/spec/fixtures/softwire_imports/case_logs/0ead17cb-1668-442d-898c-0d52879ff592.xml
@@ -52,7 +52,7 @@
Female
6) Not Seeking Work
- 1 White: English/Scottish/Welsh/Northern Irish/British
+ 17 Refused
1 UK national resident in UK
2
diff --git a/spec/models/validations/household_validations_spec.rb b/spec/models/validations/household_validations_spec.rb
index 5a3f8ee7f..ca911273f 100644
--- a/spec/models/validations/household_validations_spec.rb
+++ b/spec/models/validations/household_validations_spec.rb
@@ -120,7 +120,7 @@ RSpec.describe Validations::HouseholdValidations do
let(:field) { "validations.other_field_missing" }
it "validates that a reason is provided" do
- record.reason = 31
+ record.reason = 20
record.reasonother = nil
household_validator.validate_reason_for_leaving_last_settled_home(record)
expect(record.errors["reasonother"])
@@ -128,7 +128,7 @@ RSpec.describe Validations::HouseholdValidations do
end
it "expects that a reason is provided" do
- record.reason = 31
+ record.reason = 20
record.reasonother = "Some unusual reason"
household_validator.validate_reason_for_leaving_last_settled_home(record)
expect(record.errors["reasonother"]).to be_empty