Browse Source

Rename tasklist helper methods parameters

pull/863/head
Kat 3 years ago committed by baarkerlounger
parent
commit
0984aadf42
  1. 22
      app/helpers/tasklist_helper.rb

22
app/helpers/tasklist_helper.rb

@ -1,14 +1,14 @@
module TasklistHelper module TasklistHelper
include GovukLinkHelper include GovukLinkHelper
def get_next_incomplete_section(lettings_log) def get_next_incomplete_section(log)
lettings_log.form.subsections.find { |subsection| subsection.is_incomplete?(lettings_log) } log.form.subsections.find { |subsection| subsection.is_incomplete?(log) }
end end
def get_subsections_count(lettings_log, status = :all) def get_subsections_count(log, status = :all)
return lettings_log.form.subsections.count { |subsection| subsection.applicable_questions(lettings_log).count.positive? } if status == :all return log.form.subsections.count { |subsection| subsection.applicable_questions(log).count.positive? } if status == :all
lettings_log.form.subsections.count { |subsection| subsection.status(lettings_log) == status && subsection.applicable_questions(lettings_log).count.positive? } log.form.subsections.count { |subsection| subsection.status(log) == status && subsection.applicable_questions(log).count.positive? }
end end
def next_page_or_check_answers(subsection, log, current_user) def next_page_or_check_answers(subsection, log, current_user)
@ -20,17 +20,17 @@ module TasklistHelper
send(path, log) send(path, log)
end end
def next_question_page(subsection, lettings_log, current_user) def next_question_page(subsection, log, current_user)
if subsection.pages.first.routed_to?(lettings_log, current_user) if subsection.pages.first.routed_to?(log, current_user)
subsection.pages.first.id subsection.pages.first.id
else else
lettings_log.form.next_page(subsection.pages.first, lettings_log, current_user) log.form.next_page(subsection.pages.first, log, current_user)
end end
end end
def subsection_link(subsection, lettings_log, current_user) def subsection_link(subsection, log, current_user)
if subsection.status(lettings_log) != :cannot_start_yet if subsection.status(log) != :cannot_start_yet
next_page_path = next_page_or_check_answers(subsection, lettings_log, current_user).to_s next_page_path = next_page_or_check_answers(subsection, log, current_user).to_s
govuk_link_to(subsection.label, next_page_path.dasherize, aria: { describedby: subsection.id.dasherize }) govuk_link_to(subsection.label, next_page_path.dasherize, aria: { describedby: subsection.id.dasherize })
else else
subsection.label subsection.label

Loading…
Cancel
Save