Browse Source

CLDC-3712: Discounted ownership scheme first question bug fix (#2961)

* Fix bug, edit condition to only apply to shared ownership

* Add back missing logic to determine question number

* Update test
update-status-at
Manny Dinssa 4 days ago committed by GitHub
parent
commit
0ebae474a1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      app/models/form/sales/pages/living_before_purchase.rb
  2. 2
      app/models/form/sales/questions/living_before_purchase_years.rb
  3. 2
      spec/models/form/sales/pages/living_before_purchase_spec.rb

2
app/models/form/sales/pages/living_before_purchase.rb

@ -24,7 +24,7 @@ class Form::Sales::Pages::LivingBeforePurchase < ::Form::Page
end
def page_routed_to?(log)
return false if form.start_year_2025_or_later? && log.resale != 2
return false if form.start_year_2025_or_later? && log.resale != 2 && log.ownershipsch == 1
if @joint_purchase
log.joint_purchase?

2
app/models/form/sales/questions/living_before_purchase_years.rb

@ -9,7 +9,7 @@ class Form::Sales::Questions::LivingBeforePurchaseYears < ::Form::Question
@step = 1
@width = 5
@ownershipsch = ownershipsch
@question_number = question_number
@question_number = QUESTION_NUMBER_FROM_YEAR_AND_OWNERSHIP.fetch(form.start_date.year, QUESTION_NUMBER_FROM_YEAR_AND_OWNERSHIP.max_by { |k, _v| k }.last)[ownershipsch]
end
def suffix_label(log)

2
spec/models/form/sales/pages/living_before_purchase_spec.rb

@ -95,7 +95,7 @@ RSpec.describe Form::Sales::Pages::LivingBeforePurchase, type: :model do
end
it "does not route to the page when resale is not 2" do
log = build(:sales_log, jointpur: 1, resale: nil)
log = build(:sales_log, jointpur: 1, resale: nil, ownershipsch: 1)
expect(page.routed_to?(log, nil)).to eq(false)
end
end

Loading…
Cancel
Save