diff --git a/app/services/update_assessment_section.rb b/app/services/update_assessment_section.rb index 736817eb6d..4dcb1bbd6b 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 + return if assessment.started_at || assessment_section.preliminary 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 63c890bd1e..f8b08b4bbc 100644 --- a/spec/services/update_assessment_section_spec.rb +++ b/spec/services/update_assessment_section_spec.rb @@ -121,7 +121,15 @@ context "with an existing assessment started at" do before { assessment.update!(started_at: Date.new(2021, 1, 1)) } - it "doesn't change the assessor" do + 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 expect { subject }.to_not change(assessment, :started_at) end end