Browse Source

Update routing and check for page existence in guidance

pull/2782/head
Kat 7 months ago
parent
commit
a7755cc107
  1. 6
      app/models/form/sales/pages/living_before_purchase.rb
  2. 4
      app/views/form/guidance/_financial_calculations_shared_ownership.html.erb

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

@ -24,9 +24,9 @@ class Form::Sales::Pages::LivingBeforePurchase < ::Form::Page
end
def page_routed_to?(log)
if form.start_year_2025_or_later?
log.resale == 2
elsif @joint_purchase
return false if form.start_year_2025_or_later? && log.resale != 2
if @joint_purchase
log.joint_purchase?
else
log.not_joint_purchase? || log.jointpur.nil?

4
app/views/form/guidance/_financial_calculations_shared_ownership.html.erb

@ -20,8 +20,8 @@
<% end %>
must equal
the purchase price <%= question_link("value", log, current_user) %>
<% stairbought_page = log.form.get_question("stairbought", log).page %>
<% if stairbought_page.routed_to?(log, current_user) %>
<% stairbought_page = log.form.get_question("stairbought", log)&.page %>
<% if stairbought_page&.routed_to?(log, current_user) %>
multiplied by the percentage bought <%= question_link("stairbought", log, current_user) %>
<% else %>
multiplied by the percentage equity stake <%= question_link("equity", log, current_user) %>

Loading…
Cancel
Save