From 3ce699a234761a15d3e6fa54215dda1383de4b64 Mon Sep 17 00:00:00 2001 From: Nat Dean-Lewis Date: Wed, 25 Mar 2026 11:34:51 +0000 Subject: [PATCH] CLDC-4333: update hint text instead to ensure value is 100% of equity --- .../validations/sales/soft_validations.rb | 15 +---- .../forms/2025/sales/sale_information.en.yml | 4 +- .../forms/2026/sales/sale_information.en.yml | 4 +- .../sales/soft_validations_spec.rb | 56 ------------------- 4 files changed, 7 insertions(+), 72 deletions(-) diff --git a/app/models/validations/sales/soft_validations.rb b/app/models/validations/sales/soft_validations.rb index 2cf4742d8..ce7a812d2 100644 --- a/app/models/validations/sales/soft_validations.rb +++ b/app/models/validations/sales/soft_validations.rb @@ -96,9 +96,8 @@ module Validations::Sales::SoftValidations def purchase_price_out_of_soft_range? return unless value && beds && la && sale_range - return if is_staircase? && !stairbought&.positive? - !full_purchase_price.between?(sale_range.soft_min, sale_range.soft_max) + !value.between?(sale_range.soft_min, sale_range.soft_max) end def staircase_owned_out_of_soft_range? @@ -137,11 +136,11 @@ module Validations::Sales::SoftValidations end def purchase_price_higher_or_lower_text - full_purchase_price < sale_range.soft_min ? "lower" : "higher" + value < sale_range.soft_min ? "lower" : "higher" end def purchase_price_soft_min_or_soft_max - full_purchase_price < sale_range.soft_min ? sale_range.soft_min : sale_range.soft_max + value < sale_range.soft_min ? sale_range.soft_min : sale_range.soft_max end def grant_outside_common_range? @@ -204,14 +203,6 @@ module Validations::Sales::SoftValidations private - def full_purchase_price - if is_staircase? && stairbought&.positive? - value * 100 / stairbought - else - value - end - end - def sale_range LaSaleRange.find_by( start_year: collection_start_year, diff --git a/config/locales/forms/2025/sales/sale_information.en.yml b/config/locales/forms/2025/sales/sale_information.en.yml index 7360c3a41..fa95431be 100644 --- a/config/locales/forms/2025/sales/sale_information.en.yml +++ b/config/locales/forms/2025/sales/sale_information.en.yml @@ -153,8 +153,8 @@ en: value_shared_ownership_staircase: check_answer_label: "Full purchase price" check_answer_prompt: "" - hint_text: "Enter the full purchase price paid for the equity bought in this staircasing transaction (this is equal to the value of the share bought by the purchaser)." - question_text: "What was the full purchase price for this staircasing transaction?" + hint_text: "Enter the full purchase price of the property before any discounts are applied. For shared ownership, enter the full purchase price paid for 100% equity (this is equal to the value of the share owned by the PRP plus the value bought by the purchaser in the current and all previous transactions)." + question_text: "What was the full purchase price?" equity: page_header: "About the price of the property" diff --git a/config/locales/forms/2026/sales/sale_information.en.yml b/config/locales/forms/2026/sales/sale_information.en.yml index f09d9ab3e..e98c28018 100644 --- a/config/locales/forms/2026/sales/sale_information.en.yml +++ b/config/locales/forms/2026/sales/sale_information.en.yml @@ -153,8 +153,8 @@ en: value_shared_ownership_staircase: check_answer_label: "Full purchase price" check_answer_prompt: "" - hint_text: "Enter the full purchase price paid for the equity bought in this staircasing transaction (this is equal to the value of the share bought by the purchaser)." - question_text: "What was the full purchase price for this staircasing transaction?" + hint_text: "Enter the full purchase price of the property before any discounts are applied. For shared ownership, enter the full purchase price paid for 100% equity (this is equal to the value of the share owned by the PRP plus the value bought by the purchaser in the current and all previous transactions)." + question_text: "What was the full purchase price?" equity: page_header: "About the price of the property" diff --git a/spec/models/validations/sales/soft_validations_spec.rb b/spec/models/validations/sales/soft_validations_spec.rb index 1466d2b8e..4954cbbad 100644 --- a/spec/models/validations/sales/soft_validations_spec.rb +++ b/spec/models/validations/sales/soft_validations_spec.rb @@ -809,62 +809,6 @@ RSpec.describe Validations::Sales::SoftValidations do expect(record).not_to be_purchase_price_out_of_soft_range end - context "when staircasing" do - it "is not out of range when stairbought is 10% and value is 20,000 (full price 200,000 is in soft range)" do - record.staircase = 1 - record.stairbought = 10 - record.value = 20_000 - record.beds = 2 - record.la = "E07000223" - record.saledate = Time.zone.local(2023, 1, 1) - - expect(record).not_to be_purchase_price_out_of_soft_range - end - - it "is out of range when stairbought is 10% and value is 17,000 (full price 170,000 is below soft min of 177,000)" do - record.staircase = 1 - record.stairbought = 10 - record.value = 17_000 - record.beds = 2 - record.la = "E07000223" - record.saledate = Time.zone.local(2023, 1, 1) - - expect(record).to be_purchase_price_out_of_soft_range - end - - it "is out of range when stairbought is 10% and value is 40,000 (full price 400,000 is above soft max of 384,000)" do - record.staircase = 1 - record.stairbought = 10 - record.value = 40_000 - record.beds = 2 - record.la = "E07000223" - record.saledate = Time.zone.local(2023, 1, 1) - - expect(record).to be_purchase_price_out_of_soft_range - end - - it "does not trigger when stairbought is not set" do - record.staircase = 1 - record.stairbought = nil - record.value = 20_000 - record.beds = 2 - record.la = "E07000223" - record.saledate = Time.zone.local(2023, 1, 1) - - expect(record).not_to be_purchase_price_out_of_soft_range - end - - it "does not trigger when stairbought is 0" do - record.staircase = 1 - record.stairbought = 0 - record.value = 20_000 - record.beds = 2 - record.la = "E07000223" - record.saledate = Time.zone.local(2023, 1, 1) - - expect(record).not_to be_purchase_price_out_of_soft_range - end - end end describe "#grant_outside_common_range?" do