diff --git a/app/helpers/tasklist_helper.rb b/app/helpers/tasklist_helper.rb index 6512be4d2..61fb7dbe5 100644 --- a/app/helpers/tasklist_helper.rb +++ b/app/helpers/tasklist_helper.rb @@ -29,10 +29,6 @@ module TasklistHelper :in_progress end - def all_questions_completed(case_log) - case_log.attributes.all? { |_question, answer| answer.present?} - end - def get_status_style(status_label) STYLES[status_label] end @@ -40,4 +36,19 @@ module TasklistHelper def get_status_label(status) STATUSES[status] end + + def get_next_incomplete_section(form, case_log) + subsections = form.all_subsections.keys + return subsections.find { |subsection| is_incomplete?(subsection, case_log) } + end + + private + def all_questions_completed(case_log) + case_log.attributes.all? { |_question, answer| answer.present?} + end + + def is_incomplete?(subsection, case_log) + status = get_subsection_status(subsection, case_log) + return status == :not_started || status == :in_progress + end end diff --git a/app/views/case_logs/_tasklist.html.erb b/app/views/case_logs/_tasklist.html.erb index dd139fe9b..df9c6d28b 100644 --- a/app/views/case_logs/_tasklist.html.erb +++ b/app/views/case_logs/_tasklist.html.erb @@ -8,7 +8,7 @@