Skip to content

Commit

Permalink
Merge pull request #1688 from DFE-Digital/preliminary-assessment-in-p…
Browse files Browse the repository at this point in the history
…rogress

Only change to assessment in progress if not preliminary
  • Loading branch information
thomasleese authored Sep 13, 2023
2 parents 7d7bfb8 + c846b1e commit e2b8dca
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 19 deletions.
2 changes: 1 addition & 1 deletion app/lib/application_form_status_updater.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
12 changes: 4 additions & 8 deletions app/models/assessment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,6 @@ def request_further_information!
)
end

def started?
any_section_finished?
end

def completed?
award? || decline?
end
Expand Down Expand Up @@ -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
Expand Down
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 || assessment_section.preliminary
return if assessment.started_at
assessment.update!(started_at: Time.zone.now)
end

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

0 comments on commit e2b8dca

Please sign in to comment.