Skip to content

Commit

Permalink
Don't set started at on preliminary assessment sections
Browse files Browse the repository at this point in the history
This doesn't count as part of the assessment, so we shouldn't be
recording the started at date of the assessment as part of the
preliminary check.
  • Loading branch information
thomasleese committed Sep 13, 2023
1 parent 38b30c5 commit ae4debc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/services/update_assessment_section.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 9 additions & 1 deletion spec/services/update_assessment_section_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ae4debc

Please sign in to comment.