Skip to content

Commit

Permalink
Merge pull request #1686 from DFE-Digital/started-at-preliminary
Browse files Browse the repository at this point in the history
Don't set started at on preliminary assessment sections
  • Loading branch information
thomasleese authored Sep 13, 2023
2 parents 074169b + ae4debc commit 7d7bfb8
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 7d7bfb8

Please sign in to comment.