From 752cd70120627d6cb6cf4edf145e3ec88701464f Mon Sep 17 00:00:00 2001 From: Kat Date: Tue, 28 Feb 2023 13:05:14 +0000 Subject: [PATCH] Update mortgage known question options --- app/models/form/sales/questions/mortgage_length.rb | 2 +- .../form/sales/questions/mortgage_length_known.rb | 8 ++++---- app/services/imports/sales_logs_import_service.rb | 4 ++-- spec/factories/sales_log.rb | 2 +- .../form/sales/questions/mortgage_length_known_spec.rb | 10 ++++++---- .../form/sales/questions/mortgage_length_spec.rb | 2 +- 6 files changed, 15 insertions(+), 13 deletions(-) diff --git a/app/models/form/sales/questions/mortgage_length.rb b/app/models/form/sales/questions/mortgage_length.rb index 45b1ebb25..706b7d3ee 100644 --- a/app/models/form/sales/questions/mortgage_length.rb +++ b/app/models/form/sales/questions/mortgage_length.rb @@ -11,7 +11,7 @@ class Form::Sales::Questions::MortgageLength < ::Form::Question @suffix = " years" @hint_text = "You should round up to the nearest year. Value should not exceed 60 years." @inferred_check_answers_value = [{ - "condition" => { "mortlen_known" => 1 }, + "condition" => { "mortlen_known" => 2 }, "value" => "Not known", }] end diff --git a/app/models/form/sales/questions/mortgage_length_known.rb b/app/models/form/sales/questions/mortgage_length_known.rb index 3455d17a8..af55eadc2 100644 --- a/app/models/form/sales/questions/mortgage_length_known.rb +++ b/app/models/form/sales/questions/mortgage_length_known.rb @@ -12,17 +12,17 @@ class Form::Sales::Questions::MortgageLengthKnown < ::Form::Question @hidden_in_check_answers = { "depends_on" => [ { - "mortlen_known" => 0, + "mortlen_known" => 1, }, { - "mortlen_known" => 1, + "mortlen_known" => 2, }, ], } end ANSWER_OPTIONS = { - "0" => { "value" => "Yes" }, - "1" => { "value" => "No" }, + "1" => { "value" => "Yes" }, + "2" => { "value" => "No" }, }.freeze end diff --git a/app/services/imports/sales_logs_import_service.rb b/app/services/imports/sales_logs_import_service.rb index 440ae5f71..a26267129 100644 --- a/app/services/imports/sales_logs_import_service.rb +++ b/app/services/imports/sales_logs_import_service.rb @@ -118,7 +118,7 @@ module Imports attributes["mortgagelender"] = mortgage_lender(xml_doc, attributes) attributes["mortgagelenderother"] = mortgage_lender_other(xml_doc, attributes) attributes["mortlen"] = mortgage_length(xml_doc, attributes) - attributes["mortlen_known"] = 0 if attributes["mortlen"].present? + attributes["mortlen_known"] = 1 if attributes["mortlen"].present? attributes["extrabor"] = borrowing(xml_doc, attributes) attributes["totadult"] = safe_string_as_integer(xml_doc, "TOTADULT") # would get overridden attributes["totchild"] = safe_string_as_integer(xml_doc, "TOTCHILD") # would get overridden @@ -405,7 +405,7 @@ module Imports attributes["hb"] ||= 4 attributes["prevown"] ||= 3 attributes["savingsnk"] ||= attributes["savings"].present? ? 0 : 1 - attributes["mortlen_known"] ||= 1 if attributes["mortgage"].blank? + attributes["mortlen_known"] ||= 2 if attributes["mortgage"].blank? # attributes["noint"] = 1 # not interviewed # buyer 1 characteristics diff --git a/spec/factories/sales_log.rb b/spec/factories/sales_log.rb index d2294dbd9..761a52c8a 100644 --- a/spec/factories/sales_log.rb +++ b/spec/factories/sales_log.rb @@ -95,7 +95,7 @@ FactoryBot.define do armedforcesspouse { 5 } mscharge_known { 1 } mscharge { 100 } - mortlen_known { 0 } + mortlen_known { 1 } mortlen { 10 } pcodenk { 1 } is_la_inferred { false } diff --git a/spec/models/form/sales/questions/mortgage_length_known_spec.rb b/spec/models/form/sales/questions/mortgage_length_known_spec.rb index b58a142d5..edf43a918 100644 --- a/spec/models/form/sales/questions/mortgage_length_known_spec.rb +++ b/spec/models/form/sales/questions/mortgage_length_known_spec.rb @@ -33,8 +33,8 @@ RSpec.describe Form::Sales::Questions::MortgageLengthKnown, type: :model do it "has the correct answer_options" do expect(question.answer_options).to eq({ - "0" => { "value" => "Yes" }, - "1" => { "value" => "No" }, + "1" => { "value" => "Yes" }, + "2" => { "value" => "No" }, }) end @@ -47,9 +47,11 @@ RSpec.describe Form::Sales::Questions::MortgageLengthKnown, type: :model do it "has correct hidden in check answers" do expect(question.hidden_in_check_answers).to eq({ "depends_on" => [{ - "mortlen_known" => 0, + "mortlen_known" => 1, }, - { "mortlen_known" => 1 }], + { + "mortlen_known" => 2, + }], }) end end diff --git a/spec/models/form/sales/questions/mortgage_length_spec.rb b/spec/models/form/sales/questions/mortgage_length_spec.rb index 75db84658..414f757ca 100644 --- a/spec/models/form/sales/questions/mortgage_length_spec.rb +++ b/spec/models/form/sales/questions/mortgage_length_spec.rb @@ -56,7 +56,7 @@ RSpec.describe Form::Sales::Questions::MortgageLength, type: :model do it "has correct inferred check answers value" do expect(question.inferred_check_answers_value).to eq([ { - "condition" => { "mortlen_known" => 1 }, + "condition" => { "mortlen_known" => 2 }, "value" => "Not known", }, ])