Submit social housing lettings and sales data (CORE)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

21 lines
647 B

module TasklistHelper
def get_subsection_status(subsection_name, case_log)
@form = Form.new(2021, 2022)
questions = @form.questions_for_subsection(subsection_name).keys
if subsection_name == "declaration"
return all_questions_completed(case_log) ? "Not started" : "Cannot start yet"
end
if questions.all? {|question| case_log[question].blank?}
return "Not started"
end
if questions.all? {|question| case_log[question].present?}
return "Completed"
end
"In progress"
end
def all_questions_completed(case_log)
case_log.attributes.all? { |_question, answer| answer.present?}
end
end