Browse Source

Other household members derived (#425)

pull/429/head
baarkerlounger 3 years ago committed by GitHub
parent
commit
de7ab9db1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      app/models/case_log.rb
  2. 6
      config/forms/2021_2022.json
  3. 8
      spec/models/case_log_spec.rb

2
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

6
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

8
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

Loading…
Cancel
Save