Skip to content

Commit

Permalink
Allow admins to respond to LoPS
Browse files Browse the repository at this point in the history
This ensures that admins are marked as the action required by user type
when the LoPS has been marked as received, or is overdue.
  • Loading branch information
thomasleese committed Oct 13, 2023
1 parent 79db3bf commit 448553a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 deletions.
32 changes: 22 additions & 10 deletions app/lib/application_form_status_updater.rb
Original file line number Diff line number Diff line change
Expand Up @@ -180,14 +180,14 @@ def action_required_by
application_form.declined_at.present? ||
application_form.awarded_at.present?
"none"
elsif preliminary_check?
"admin"
elsif dqt_trn_request.present? || assessment_in_review? ||
overdue_further_information || overdue_lops ||
overdue_qualification || overdue_reference ||
received_further_information || received_lops ||
overdue_further_information || overdue_qualification ||
overdue_reference || received_further_information ||
received_qualification || received_reference
"assessor"
elsif preliminary_check? || need_to_request_lops? || overdue_lops ||
received_lops
"admin"
elsif waiting_on_further_information || waiting_on_lops ||
waiting_on_qualification || waiting_on_reference
"external"
Expand All @@ -209,10 +209,10 @@ def stage
elsif preliminary_check? ||
(teaching_authority_provides_written_statement && waiting_on_lops)
"pre_assessment"
elsif assessment_in_verify? || overdue_lops || overdue_qualification ||
overdue_reference || received_lops || received_qualification ||
received_reference || waiting_on_lops || waiting_on_qualification ||
waiting_on_reference
elsif assessment_in_verify? || need_to_request_lops? || overdue_lops ||
overdue_qualification || overdue_reference || received_lops ||
received_qualification || received_reference || waiting_on_lops ||
waiting_on_qualification || waiting_on_reference
"verification"
elsif overdue_further_information || received_further_information ||
waiting_on_further_information ||
Expand Down Expand Up @@ -247,7 +247,11 @@ def statuses
elsif requestable_statuses.present?
requestable_statuses
elsif assessment_in_verify?
%w[verification_in_progress]
if need_to_request_lops?
%w[verification_not_started]
else
%w[verification_in_progress]
end
elsif assessment.any_not_preliminary_section_finished?
%w[assessment_in_progress]
else
Expand Down Expand Up @@ -284,6 +288,14 @@ def assessment_in_verify?
assessment&.verify? || false
end

def need_to_request_lops?
return false if teaching_authority_provides_written_statement

professional_standing_requests.any? do |requestable|
!requestable.requested?
end
end

def requestable_statuses
@requestable_statuses ||=
%w[overdue received waiting_on]
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/application_form_status_updater_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@
create(:professional_standing_request, :received, assessment:)
end

include_examples "changes action required by", "assessor"
include_examples "changes action required by", "admin"
include_examples "changes stage", "verification"
include_examples "changes statuses", %w[received_lops]
include_examples "changes status", "received"
Expand Down

0 comments on commit 448553a

Please sign in to comment.