Skip to content

Commit

Permalink
Merge pull request #1794 from DFE-Digital/reference-request-in-progress
Browse files Browse the repository at this point in the history
Update status if references not yet verified
  • Loading branch information
thomasleese authored Nov 8, 2023
2 parents 6a7a2eb + 7b8800e commit 56e0d2b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
11 changes: 9 additions & 2 deletions app/lib/application_form_status_updater.rb
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@ def waiting_on_reference
waiting_on?(requestables: reference_requests)
end

def needs_references_verified?
reference_requests.present? && !waiting_on_reference &&
references_verified != true
end

def status
@status ||=
if dqt_trn_request&.potential_duplicate?
Expand Down Expand Up @@ -178,7 +183,8 @@ def action_required_by
elsif dqt_trn_request.present? || assessment_in_review? ||
overdue_further_information || overdue_qualification ||
overdue_reference || received_further_information ||
received_qualification || received_reference
received_qualification || received_reference ||
needs_references_verified?
"assessor"
elsif preliminary_check? || need_to_request_lops? || overdue_lops ||
received_lops
Expand Down Expand Up @@ -207,7 +213,8 @@ def stage
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
waiting_on_qualification || waiting_on_reference ||
needs_references_verified?
"verification"
elsif overdue_further_information || received_further_information ||
waiting_on_further_information ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,10 @@ def reference_requests_task_list_item
if assessment.references_verified
:completed
else
requestables_task_item_status(reference_requests)
requestables_task_item_status(
reference_requests,
default: :in_progress,
)
end
),
}
Expand Down Expand Up @@ -452,11 +455,11 @@ def initial_assessment_recommendation_complete?
!assessment.unknown? && !request_further_information_unfinished?
end

def requestables_task_item_status(requestables)
def requestables_task_item_status(requestables, default: :completed)
unreviewed_requests = requestables.reject(&:reviewed?)

if unreviewed_requests.empty?
:completed
default
elsif unreviewed_requests.any?(&:expired?)
:overdue
elsif unreviewed_requests.any?(&:received?)
Expand Down

0 comments on commit 56e0d2b

Please sign in to comment.