From 7d8217fdc41d4387b39c7cf7a06134a75efd8932 Mon Sep 17 00:00:00 2001 From: Thomas Leese Date: Wed, 13 Sep 2023 17:08:27 +0100 Subject: [PATCH 1/2] Revert "Don't set started at on preliminary assessment sections" This reverts commit ae4debc3521f00aedad7f81f398e042e83390ba0. --- app/services/update_assessment_section.rb | 2 +- spec/services/update_assessment_section_spec.rb | 10 +--------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/app/services/update_assessment_section.rb b/app/services/update_assessment_section.rb index 4dcb1bbd6b..736817eb6d 100644 --- a/app/services/update_assessment_section.rb +++ b/app/services/update_assessment_section.rb @@ -76,7 +76,7 @@ def create_timeline_event(old_state:) end def update_assessment_started_at - return if assessment.started_at || assessment_section.preliminary + return if assessment.started_at assessment.update!(started_at: Time.zone.now) end diff --git a/spec/services/update_assessment_section_spec.rb b/spec/services/update_assessment_section_spec.rb index f8b08b4bbc..63c890bd1e 100644 --- a/spec/services/update_assessment_section_spec.rb +++ b/spec/services/update_assessment_section_spec.rb @@ -121,15 +121,7 @@ context "with an existing assessment started at" do before { assessment.update!(started_at: Date.new(2021, 1, 1)) } - it "doesn't change the started" do - expect { subject }.to_not change(assessment, :started_at) - end - end - - context "with a preliminary assessment section" do - before { assessment_section.update!(preliminary: true) } - - it "doesn't change the started" do + it "doesn't change the assessor" do expect { subject }.to_not change(assessment, :started_at) end end From c846b1e908cd23966a5f673cfa64257bf3f74341 Mon Sep 17 00:00:00 2001 From: Thomas Leese Date: Wed, 13 Sep 2023 17:13:53 +0100 Subject: [PATCH 2/2] Only change to assessment in progress if not preliminary This changes the logic so applications will only move to assessment in progress if there are non-preliminary sections finished. --- app/lib/application_form_status_updater.rb | 2 +- app/models/assessment.rb | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/app/lib/application_form_status_updater.rb b/app/lib/application_form_status_updater.rb index 3db67a65e1..0a5299be8e 100644 --- a/app/lib/application_form_status_updater.rb +++ b/app/lib/application_form_status_updater.rb @@ -141,7 +141,7 @@ def new_status waiting_on_professional_standing || waiting_on_qualification || waiting_on_reference "waiting_on" - elsif assessment&.started? + elsif assessment&.any_not_preliminary_section_finished? "assessment_in_progress" elsif application_form.submitted_at.present? "submitted" diff --git a/app/models/assessment.rb b/app/models/assessment.rb index e9b678a29a..75e9933490 100644 --- a/app/models/assessment.rb +++ b/app/models/assessment.rb @@ -79,10 +79,6 @@ def request_further_information! ) end - def started? - any_section_finished? - end - def completed? award? || decline? end @@ -162,16 +158,16 @@ def any_preliminary_section_failed? sections.preliminary.any?(&:failed) end + def any_not_preliminary_section_finished? + sections.not_preliminary.any?(&:finished?) + end + private def all_sections_finished? sections.all?(&:finished?) end - def any_section_finished? - sections.any?(&:finished?) - end - def all_sections_passed? sections.all?(&:passed) end