diff --git a/app/models/form/sales/pages/about_deposit_with_discount.rb b/app/models/form/sales/pages/about_deposit_with_discount.rb index 5d1e41a95..4f1eed451 100644 --- a/app/models/form/sales/pages/about_deposit_with_discount.rb +++ b/app/models/form/sales/pages/about_deposit_with_discount.rb @@ -14,9 +14,9 @@ class Form::Sales::Pages::AboutDepositWithDiscount < ::Form::Page def depends_on if form.start_year_after_2024? - [{ "is_type_discount?" => true, "stairowned_100?" => @optional }] + [{ "social_homebuy?" => true, "stairowned_100?" => @optional }] else - [{ "is_type_discount?" => true }] + [{ "social_homebuy?" => true }] end end end 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 fdd74cf31..5747c3ed4 100644 --- a/app/models/form/sales/pages/about_deposit_without_discount.rb +++ b/app/models/form/sales/pages/about_deposit_without_discount.rb @@ -14,11 +14,11 @@ class Form::Sales::Pages::AboutDepositWithoutDiscount < ::Form::Page def depends_on if form.start_year_after_2024? - [{ "is_type_discount?" => false, "ownershipsch" => 1, "stairowned_100?" => @optional }, + [{ "social_homebuy?" => false, "ownershipsch" => 1, "stairowned_100?" => @optional }, { "ownershipsch" => 2 }, { "ownershipsch" => 3, "mortgageused" => 1 }] else - [{ "is_type_discount?" => false, "ownershipsch" => 1 }, + [{ "social_homebuy?" => false, "ownershipsch" => 1 }, { "ownershipsch" => 2 }, { "ownershipsch" => 3, "mortgageused" => 1 }] end diff --git a/app/models/sales_log.rb b/app/models/sales_log.rb index f35393a51..c02414a95 100644 --- a/app/models/sales_log.rb +++ b/app/models/sales_log.rb @@ -239,7 +239,7 @@ class SalesLog < Log ownershipsch == 3 || (ownershipsch == 2 && rent_to_buy_full_ownership?) end - def is_type_discount? + def social_homebuy? type == 18 end diff --git a/app/models/validations/sales/soft_validations.rb b/app/models/validations/sales/soft_validations.rb index 14c0afae4..55b882a5d 100644 --- a/app/models/validations/sales/soft_validations.rb +++ b/app/models/validations/sales/soft_validations.rb @@ -86,7 +86,7 @@ module Validations::Sales::SoftValidations def shared_ownership_deposit_invalid? return unless saledate && collection_start_year <= 2023 return unless mortgage || mortgageused == 2 || mortgageused == 3 - return unless cashdis || !is_type_discount? + return unless cashdis || !social_homebuy? return unless deposit && value && equity !within_tolerance?(mortgage_deposit_and_discount_total, value * equity / 100, 1) diff --git a/spec/models/form/sales/pages/about_deposit_with_discount_spec.rb b/spec/models/form/sales/pages/about_deposit_with_discount_spec.rb index 4cffb2b54..fabfb7836 100644 --- a/spec/models/form/sales/pages/about_deposit_with_discount_spec.rb +++ b/spec/models/form/sales/pages/about_deposit_with_discount_spec.rb @@ -33,7 +33,7 @@ RSpec.describe Form::Sales::Pages::AboutDepositWithDiscount, type: :model do it "has correct depends_on" do expect(page.depends_on).to eq( - [{ "is_type_discount?" => true }], + [{ "social_homebuy?" => true }], ) end @@ -42,7 +42,7 @@ RSpec.describe Form::Sales::Pages::AboutDepositWithDiscount, type: :model do it "has correct depends_on" do expect(page.depends_on).to eq( - [{ "is_type_discount?" => true }], + [{ "social_homebuy?" => true }], ) end end @@ -54,7 +54,7 @@ RSpec.describe Form::Sales::Pages::AboutDepositWithDiscount, type: :model do it "has correct depends_on" do expect(page.depends_on).to eq( - [{ "is_type_discount?" => true, "stairowned_100?" => false }], + [{ "social_homebuy?" => true, "stairowned_100?" => false }], ) end @@ -63,7 +63,7 @@ RSpec.describe Form::Sales::Pages::AboutDepositWithDiscount, type: :model do it "has correct depends_on" do expect(page.depends_on).to eq( - [{ "is_type_discount?" => true, "stairowned_100?" => true }], + [{ "social_homebuy?" => true, "stairowned_100?" => 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 d6f58c65f..003313353 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 @@ -33,7 +33,7 @@ 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, "ownershipsch" => 1 }, + [{ "social_homebuy?" => false, "ownershipsch" => 1 }, { "ownershipsch" => 2 }, { "ownershipsch" => 3, "mortgageused" => 1 }], ) @@ -44,7 +44,7 @@ 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, "ownershipsch" => 1 }, + [{ "social_homebuy?" => false, "ownershipsch" => 1 }, { "ownershipsch" => 2 }, { "ownershipsch" => 3, "mortgageused" => 1 }], ) @@ -58,7 +58,7 @@ 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, "ownershipsch" => 1, "stairowned_100?" => false }, + [{ "social_homebuy?" => false, "ownershipsch" => 1, "stairowned_100?" => false }, { "ownershipsch" => 2 }, { "ownershipsch" => 3, "mortgageused" => 1 }], ) @@ -69,7 +69,7 @@ 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, "ownershipsch" => 1, "stairowned_100?" => true }, + [{ "social_homebuy?" => false, "ownershipsch" => 1, "stairowned_100?" => true }, { "ownershipsch" => 2 }, { "ownershipsch" => 3, "mortgageused" => 1 }], )