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 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