From 3c43f23fd16e33fb5e7ff7f8a01e106c6b81930b Mon Sep 17 00:00:00 2001 From: Kat Date: Tue, 17 Jan 2023 08:48:49 +0000 Subject: [PATCH] more routing --- app/models/form/sales/pages/about_deposit_without_discount.rb | 4 +++- app/models/form/sales/questions/deposit_amount.rb | 4 ++++ .../form/sales/pages/about_deposit_without_discount_spec.rb | 4 +++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/models/form/sales/pages/about_deposit_without_discount.rb b/app/models/form/sales/pages/about_deposit_without_discount.rb index 26a6d23b5..e8e387eba 100644 --- a/app/models/form/sales/pages/about_deposit_without_discount.rb +++ b/app/models/form/sales/pages/about_deposit_without_discount.rb @@ -2,7 +2,9 @@ class Form::Sales::Pages::AboutDepositWithoutDiscount < ::Form::Page def initialize(id, hsh, subsection) super @header = "About the deposit" - @depends_on = [{ "is_type_discount?" => false, "mortgageused" => 1 }] + @depends_on = [{ "is_type_discount?" => false, "ownershipsch" => 1 }, + { "ownershipsch" => 2 }, + { "ownershipsch" => 3, "mortgageused" => 1 }] end def questions diff --git a/app/models/form/sales/questions/deposit_amount.rb b/app/models/form/sales/questions/deposit_amount.rb index 56f8d43aa..094f47697 100644 --- a/app/models/form/sales/questions/deposit_amount.rb +++ b/app/models/form/sales/questions/deposit_amount.rb @@ -11,4 +11,8 @@ class Form::Sales::Questions::DepositAmount < ::Form::Question @hint_text = "Enter the total cash sum paid by the buyer towards the property that was not funded by the mortgage" @derived = true end + + def selected_answer_option_is_derived?(_log) + true + end end diff --git a/spec/models/form/sales/pages/about_deposit_without_discount_spec.rb b/spec/models/form/sales/pages/about_deposit_without_discount_spec.rb index 81d77ad94..62212e011 100644 --- a/spec/models/form/sales/pages/about_deposit_without_discount_spec.rb +++ b/spec/models/form/sales/pages/about_deposit_without_discount_spec.rb @@ -29,7 +29,9 @@ RSpec.describe Form::Sales::Pages::AboutDepositWithoutDiscount, type: :model do it "has correct depends_on" do expect(page.depends_on).to eq( - [{ "is_type_discount?" => false, "mortgageused" => 1 }], + [{ "is_type_discount?" => false, "ownershipsch" => 1 }, + { "ownershipsch" => 2 }, + { "ownershipsch" => 3, "mortgageused" => 1 }], ) end end