From 7b8800e16a9c93d1a4639a18d462b24a36d741a1 Mon Sep 17 00:00:00 2001 From: Thomas Leese Date: Wed, 8 Nov 2023 18:52:23 +0000 Subject: [PATCH] Update status if references not yet verified To proceed assessors have to select a radio item recording whether they have happy with the number of references that have been received, but we're not considering the status of this field anywhere. --- app/lib/application_form_status_updater.rb | 11 +++++++++-- .../application_forms_show_view_object.rb | 9 ++++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/app/lib/application_form_status_updater.rb b/app/lib/application_form_status_updater.rb index 4f5436b5b2..a2ac1535d9 100644 --- a/app/lib/application_form_status_updater.rb +++ b/app/lib/application_form_status_updater.rb @@ -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? @@ -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 @@ -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 || diff --git a/app/view_objects/assessor_interface/application_forms_show_view_object.rb b/app/view_objects/assessor_interface/application_forms_show_view_object.rb index ed35c25251..59c749a9d1 100644 --- a/app/view_objects/assessor_interface/application_forms_show_view_object.rb +++ b/app/view_objects/assessor_interface/application_forms_show_view_object.rb @@ -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 ), } @@ -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?)