diff --git a/app/models/case_log.rb b/app/models/case_log.rb index 8cb17c8cb..f45c592e7 100644 --- a/app/models/case_log.rb +++ b/app/models/case_log.rb @@ -352,7 +352,7 @@ private self.vyear = property_void_date.year end self.incref = 1 if net_income_refused? - self.hhmemb = other_hhmemb + 1 if other_hhmemb.present? + self.other_hhmemb = hhmemb - 1 if hhmemb.present? self.renttype = RENT_TYPE_MAPPING[rent_type] self.lettype = get_lettype self.totchild = get_totchild diff --git a/config/forms/2021_2022.json b/config/forms/2021_2022.json index b6762b34c..7c79550e1 100644 --- a/config/forms/2021_2022.json +++ b/config/forms/2021_2022.json @@ -1149,12 +1149,12 @@ "header": "", "description": "", "questions": { - "other_hhmemb": { - "check_answer_label": "Number of other household members", + "hhmemb": { + "check_answer_label": "Number of household members", "header": "How many people live in the household for this letting?", "hint_text": "You can provide details for a maximum of 8 people.", "type": "numeric", - "min": 0, + "min": 1, "max": 8, "step": 1, "width": 2 diff --git a/spec/models/case_log_spec.rb b/spec/models/case_log_spec.rb index 3b506e02e..9684f80a0 100644 --- a/spec/models/case_log_spec.rb +++ b/spec/models/case_log_spec.rb @@ -202,7 +202,7 @@ RSpec.describe CaseLog do mrcdate: Time.gm(2021, 5, 4), property_void_date: Time.gm(2021, 3, 3), net_income_known: 2, - other_hhmemb: 6, + hhmemb: 7, rent_type: 4, needstype: 1, hb: 1, @@ -247,9 +247,9 @@ RSpec.describe CaseLog do expect(record_from_db["incref"]).to eq(1) end - it "correctly derives and saves hhmemb" do - record_from_db = ActiveRecord::Base.connection.execute("select hhmemb from case_logs where id=#{case_log.id}").to_a[0] - expect(record_from_db["hhmemb"]).to eq(7) + it "correctly derives and saves other_hhmemb" do + record_from_db = ActiveRecord::Base.connection.execute("select other_hhmemb from case_logs where id=#{case_log.id}").to_a[0] + expect(record_from_db["other_hhmemb"]).to eq(6) end it "correctly derives and saves renttype" do