Browse Source

CLDC-1906 infer offered (#1298)

* feat: infer offered if renewal

* feat: update test

* db:update
pull/1300/head
natdeanlewissoftwire 2 years ago committed by GitHub
parent
commit
ef0fc992e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      app/models/derived_variables/lettings_log_variables.rb
  2. 2
      db/schema.rb
  3. 6
      spec/models/lettings_log_spec.rb

1
app/models/derived_variables/lettings_log_variables.rb

@ -45,6 +45,7 @@ module DerivedVariables::LettingsLogVariables
self.underoccupation_benefitcap = 2 if collection_start_year == 2021
self.referral = 1
self.waityear = 2
self.offered = 0
if is_general_needs?
# fixed term
self.prevten = 32 if managing_organisation&.provider_type == "PRP"

2
db/schema.rb

@ -524,8 +524,8 @@ ActiveRecord::Schema[7.0].define(version: 2023_02_10_143120) do
t.integer "details_known_5"
t.integer "details_known_6"
t.integer "saledate_check"
t.integer "staircasesale"
t.integer "prevshared"
t.integer "staircasesale"
t.integer "ethnic_group2"
t.integer "ethnicbuy2"
t.index ["bulk_upload_id"], name: "index_sales_logs_on_bulk_upload_id"

6
spec/models/lettings_log_spec.rb

@ -1946,12 +1946,12 @@ RSpec.describe LettingsLog do
end
context "when a non select question associated with several pages is routed to" do
let(:lettings_log) { FactoryBot.create(:lettings_log, :in_progress, period: 2) }
let(:lettings_log) { FactoryBot.create(:lettings_log, :in_progress, period: 2, needstype: 1) }
it "does not clear the answer value" do
lettings_log.update!({ offered: 4 })
lettings_log.update!({ unitletas: 1 })
lettings_log.reload
expect(lettings_log.offered).to eq(4)
expect(lettings_log.unitletas).to eq(1)
end
end

Loading…
Cancel
Save