From 91a64de4af79d8f16edc93ddb31e4b5e9abc28ca Mon Sep 17 00:00:00 2001 From: Arthur Campbell Date: Thu, 2 Mar 2023 10:57:27 +0000 Subject: [PATCH] amend method to find the path for the next question to answer so that if no questions in the next section are currently routed to, it goes to the section after that --- app/models/form.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/form.rb b/app/models/form.rb index c7bb4f2b0..9fa908427 100644 --- a/app/models/form.rb +++ b/app/models/form.rb @@ -111,8 +111,8 @@ class Form when :in_progress "#{next_subsection.id}/check_answers".dasherize when :not_started - first_question_in_subsection = next_subsection.pages.find { |page| page.routed_to?(log, nil) }.id - first_question_in_subsection.to_s.dasherize + first_question_in_subsection = next_subsection.pages.find { |page| page.routed_to?(log, nil) } + first_question_in_subsection ? first_question_in_subsection.id.to_s.dasherize : next_incomplete_section_redirect_path(next_subsection, log) else "error" end