From ef0fc992e79d5712ea8ebc13a2e159747e9497c6 Mon Sep 17 00:00:00 2001 From: natdeanlewissoftwire <94526761+natdeanlewissoftwire@users.noreply.github.com> Date: Thu, 16 Feb 2023 10:18:37 +0000 Subject: [PATCH] CLDC-1906 infer offered (#1298) * feat: infer offered if renewal * feat: update test * db:update --- app/models/derived_variables/lettings_log_variables.rb | 1 + db/schema.rb | 2 +- spec/models/lettings_log_spec.rb | 6 +++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/models/derived_variables/lettings_log_variables.rb b/app/models/derived_variables/lettings_log_variables.rb index 96b937ab4..526963d9c 100644 --- a/app/models/derived_variables/lettings_log_variables.rb +++ b/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" diff --git a/db/schema.rb b/db/schema.rb index ffea32c01..2c1ff7692 100644 --- a/db/schema.rb +++ b/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" diff --git a/spec/models/lettings_log_spec.rb b/spec/models/lettings_log_spec.rb index c8cdc466e..abe3057a6 100644 --- a/spec/models/lettings_log_spec.rb +++ b/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