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 end
def page_routed_to?(log) def page_routed_to?(log)
if form.start_year_2025_or_later? return false if form.start_year_2025_or_later? && log.resale != 2
log.resale == 2
elsif @joint_purchase if @joint_purchase
log.joint_purchase? log.joint_purchase?
else else
log.not_joint_purchase? || log.jointpur.nil? log.not_joint_purchase? || log.jointpur.nil?

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

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

Loading…
Cancel
Save