From 5500206d50ce5a258aefc57c585ec1bca765e30e Mon Sep 17 00:00:00 2001 From: baarkerlounger Date: Tue, 4 Jan 2022 16:33:40 +0000 Subject: [PATCH] About this log is only completed when privacy notice has been marked as shown --- app/models/form/subsection.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/models/form/subsection.rb b/app/models/form/subsection.rb index 19700d935..f05083172 100644 --- a/app/models/form/subsection.rb +++ b/app/models/form/subsection.rb @@ -30,11 +30,16 @@ class Form::Subsection qs = applicable_questions(case_log) return :not_started if qs.all? { |question| case_log[question.id].blank? } - return :completed if qs.all? { |question| case_log[question.id].present? } + return :completed if qs.all? { |question| case_log[question.id].present? } && !invalidated?(case_log) :in_progress end + def invalidated?(case_log) + applicable_questions(case_log).map(&:id).include?("gdpr_acceptance") && + case_log["gdpr_acceptance"] == "No" + end + def is_incomplete?(case_log) %i[not_started in_progress].include?(status(case_log)) end