diff --git a/app/helpers/tasklist_helper.rb b/app/helpers/tasklist_helper.rb index 4c831029c..549ef2d22 100644 --- a/app/helpers/tasklist_helper.rb +++ b/app/helpers/tasklist_helper.rb @@ -36,6 +36,15 @@ module TasklistHelper subsections.count { |subsection| get_subsection_status(subsection, case_log, form.questions_for_subsection(subsection).keys) == status } end + def get_first_page_or_check_answers(subsection, case_log, form, questions) + path = if is_started?(subsection, case_log, questions) + "case_log_#{subsection}_check_answers_path" + else + "case_log_#{form.first_page_for_subsection(subsection)}_path" + end + send(path, case_log) + end + private def all_questions_completed(case_log) @@ -46,4 +55,9 @@ private status = get_subsection_status(subsection, case_log, questions) %i[not_started in_progress].include?(status) end + + def is_started?(subsection, case_log, questions) + status = get_subsection_status(subsection, case_log, questions) + %i[in_progress completed].include?(status) + end end diff --git a/app/views/case_logs/_tasklist.html.erb b/app/views/case_logs/_tasklist.html.erb index dbbeb6321..fdf4c5aa9 100644 --- a/app/views/case_logs/_tasklist.html.erb +++ b/app/views/case_logs/_tasklist.html.erb @@ -9,9 +9,10 @@