Browse Source

Remove needs type question until we support supported housing logs (#569)

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

2
app/models/case_log.rb

@ -438,6 +438,8 @@ private
end
def set_derived_fields!
# TODO: Remove once we support supported housing logs
self.needstype = 1 unless needstype
if rsnvac.present?
self.newprop = has_first_let_vacancy_reason? ? 1 : 2
end

4
config/forms/2021_2022.json

@ -27,7 +27,9 @@
}
}
}
}
},
"derived": true,
"depends_on": [false]
},
"renewal": {
"header": "",

4
config/forms/2022_2023.json

@ -27,7 +27,9 @@
}
}
}
}
},
"derived": true,
"depends_on": [false]
},
"renewal": {
"header": "",

8
spec/models/case_log_spec.rb

@ -210,12 +210,17 @@ RSpec.describe CaseLog do
net_income_known: 2,
hhmemb: 7,
rent_type: 4,
needstype: 1,
hb: 1,
hbrentshortfall: 1,
})
end
it "derives that all forms are general needs" do
record_from_db = ActiveRecord::Base.connection.execute("select needstype from case_logs where id=#{case_log.id}").to_a[0]
expect(record_from_db["needstype"]).to eq(1)
expect(case_log["needstype"]).to eq(1)
end
it "correctly derives and saves partial and full major repairs date" do
record_from_db = ActiveRecord::Base.connection.execute("select mrcdate from case_logs where id=#{case_log.id}").to_a[0]
expect(record_from_db["mrcdate"].day).to eq(4)
@ -1127,6 +1132,7 @@ RSpec.describe CaseLog do
expect(address_case_log[postcode_field]).to eq("M11AE")
expect(record_from_db[postcode_field]).to eq("M11AE")
end
context "when saving addresses" do
before do
stub_request(:get, /api.postcodes.io/)

Loading…
Cancel
Save