From deb74f97c96a302116e7c7e4741fdfc0a35f140f Mon Sep 17 00:00:00 2001 From: baarkerlounger Date: Wed, 4 May 2022 11:41:26 +0100 Subject: [PATCH] Make case log status rely on subsection status so they can't get out of sync --- app/models/case_log.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/case_log.rb b/app/models/case_log.rb index 252b6e360..fd977e11e 100644 --- a/app/models/case_log.rb +++ b/app/models/case_log.rb @@ -609,7 +609,8 @@ private end def all_fields_completed? - mandatory_fields.none? { |field| public_send(field).nil? if respond_to?(field) } + subsection_statuses = form.subsections.map { |subsection| subsection.status(self) }.uniq + subsection_statuses == [:completed] end def all_fields_nil?