From 4562ea413475c93bc5ba79e84d67c9fcf7724412 Mon Sep 17 00:00:00 2001 From: Thomas Leese Date: Wed, 13 Mar 2024 14:44:15 +0000 Subject: [PATCH] Handle existing applications This updates the qualification verification tasks to handle the case where the qualification has gone out without consent being selected. --- app/lib/application_form_status_updater.rb | 9 ++++++--- .../qualification_requests_view_object.rb | 3 ++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/lib/application_form_status_updater.rb b/app/lib/application_form_status_updater.rb index 8b41c940e9..2503a1a5b4 100644 --- a/app/lib/application_form_status_updater.rb +++ b/app/lib/application_form_status_updater.rb @@ -164,15 +164,18 @@ def need_to_request_lops? end def need_to_request_consent? - qualification_requests.any?(&:consent_method_unknown?) || - consent_requests.any?(&:not_requested?) + ( + qualification_requests.none?(&:requested?) && + qualification_requests.any?(&:consent_method_unknown?) + ) || consent_requests.any?(&:not_requested?) end def need_to_request_ecctis? qualification_requests .select(&:not_requested?) .any? do |qualification_request| - qualification_request.consent_method_unsigned? || + qualification_request.consent_method_none? || + qualification_request.consent_method_unsigned? || consent_requests .select(&:verify_passed?) .any? do |consent_request| diff --git a/app/view_objects/assessor_interface/qualification_requests_view_object.rb b/app/view_objects/assessor_interface/qualification_requests_view_object.rb index 70e46ccedd..29a4d01160 100644 --- a/app/view_objects/assessor_interface/qualification_requests_view_object.rb +++ b/app/view_objects/assessor_interface/qualification_requests_view_object.rb @@ -30,7 +30,8 @@ def all_task_items end def all_consent_methods_selected? - qualification_requests.none?(&:consent_method_unknown?) + qualification_requests.none?(&:consent_method_unknown?) || + qualification_requests.requested.exists? end def show_individual_task_items?