Skip to content

Commit

Permalink
CLDC-3712: Discounted ownership scheme first question bug fix (#2961)
Browse files Browse the repository at this point in the history
* Fix bug, edit condition to only apply to shared ownership

* Add back missing logic to determine question number

* Update test
  • Loading branch information
Dinssa authored Feb 27, 2025
1 parent 7630b49 commit 0ebae47
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/models/form/sales/pages/living_before_purchase.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def routed_to?(log, _user)
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?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def initialize(id, hsh, page, ownershipsch:, joint_purchase:)
@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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
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
Expand Down

0 comments on commit 0ebae47

Please sign in to comment.