diff --git a/app/controllers/assessor_interface/assessments_controller.rb b/app/controllers/assessor_interface/assessments_controller.rb index 47d7c88d6b..8df872e1b8 100644 --- a/app/controllers/assessor_interface/assessments_controller.rb +++ b/app/controllers/assessor_interface/assessments_controller.rb @@ -18,6 +18,13 @@ def review @professional_standing_request = assessment.professional_standing_request if assessment.professional_standing_request&.verify_failed? + @consent_requests = + assessment + .consent_requests + .includes(:qualification) + .where(verify_passed: false) + .order_by_role + @qualification_requests = assessment .qualification_requests 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 8331076e67..94661a55f7 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 @@ -85,7 +85,8 @@ def management_tasks :teaching_authority_provides_written_statement, :work_histories, to: :application_form - delegate :professional_standing_request, + delegate :consent_requests, + :professional_standing_request, :qualification_requests, :reference_requests, to: :assessment @@ -370,7 +371,8 @@ def review_task_list_section if ( !teaching_authority_provides_written_statement && professional_standing_request&.verify_failed? - ) || qualification_requests.any?(&:verify_failed?) || + ) || consent_requests.any?(&:verify_failed?) || + qualification_requests.any?(&:verify_failed?) || reference_requests.any?(&:verify_failed?) { title: @@ -398,7 +400,8 @@ def review_verifications_task_list_item elsif ( !teaching_authority_provides_written_statement && professional_standing_request&.reviewed? - ) || reference_requests.any?(:reviewed?) + ) || consent_requests.any?(:reviewed?) || + reference_requests.any?(:reviewed?) :in_progress else :not_started diff --git a/app/views/assessor_interface/assessments/review.html.erb b/app/views/assessor_interface/assessments/review.html.erb index 4e409b7bf8..3fcde869eb 100644 --- a/app/views/assessor_interface/assessments/review.html.erb +++ b/app/views/assessor_interface/assessments/review.html.erb @@ -21,11 +21,17 @@ ], } end, - if @qualification_requests.present? + if @consent_requests.present? || @qualification_requests.present? { title: "Qualifications", indentation: false, - items: @qualification_requests.map do |qualification_request| + items: @consent_requests.map do |consent_request| + { + name: qualification_title(consent_request.qualification), + link: [:review, :assessor_interface, @application_form, @assessment, consent_request], + status: consent_request.review_status, + } + end + @qualification_requests.map do |qualification_request| { name: qualification_title(qualification_request.qualification), link: [:review, :assessor_interface, @application_form, @assessment, qualification_request], diff --git a/spec/system/assessor_interface/reviewing_consent_spec.rb b/spec/system/assessor_interface/reviewing_consent_spec.rb new file mode 100644 index 0000000000..c00fa0fd8a --- /dev/null +++ b/spec/system/assessor_interface/reviewing_consent_spec.rb @@ -0,0 +1,123 @@ +# frozen_string_literal: true + +require "rails_helper" + +RSpec.describe "Assessor reviewing references", type: :system do + before do + given_the_service_is_open + given_i_am_authorized_as_an_assessor_user + given_there_is_an_application_form_with_failed_consent + end + + it "sends for review" do + when_i_visit_the(:assessor_application_page, reference:) + then_i_see_the(:assessor_application_page, reference:) + + when_i_click_on_verification_decision + then_i_see_the(:assessor_complete_assessment_page, reference:) + + when_i_select_send_for_review + then_i_see_the(:assessor_assessment_recommendation_review_page, reference:) + + when_i_click_continue_from_review + then_i_see_the(:assessor_application_status_page, reference:) + + when_i_click_on_overview_button + then_i_see_the(:assessor_application_page, reference:) + + when_i_click_on_review_verifications + then_i_see_the( + :assessor_review_verifications_page, + reference:, + assessment_id:, + ) + and_i_see_the_consent_not_started + + when_i_click_on_back_to_overview + then_i_see_the(:assessor_application_page, reference:) + + when_i_click_on_assessment_decision + then_i_see_the( + :assessor_complete_assessment_page, + reference:, + assessment_id:, + ) + end + + private + + def given_there_is_an_application_form_with_failed_consent + application_form + end + + def when_i_click_on_verification_decision + assessor_application_page.verification_decision_task.click + end + + def when_i_select_send_for_review + assessor_complete_assessment_page.send_for_review.choose + assessor_complete_assessment_page.continue_button.click + end + + def when_i_click_continue_from_review + assessor_assessment_recommendation_review_page.continue_button.click + end + + def when_i_click_on_overview_button + assessor_application_status_page.button_group.overview_button.click + end + + def when_i_click_on_review_verifications + assessor_application_page.review_verifications_task.click + end + + def when_i_click_on_assessment_decision + assessor_application_page.assessment_decision_task.click + end + + def and_i_see_the_overdue_status + expect(assessor_review_verifications_page).to have_content( + "This qualifications’s status has changed from OVERDUE to RECEIVED", + ) + end + + def when_i_click_on_back_to_overview + assessor_review_verifications_page.back_to_overview_button.click + end + + def and_i_see_the_consent_not_started + item = + assessor_review_verifications_page.task_list.find_item("BSc Teaching") + expect(item.status_tag.text).to eq("NOT STARTED") + end + + def application_form + @application_form ||= + begin + application_form = create(:application_form, :submitted) + qualification = + create( + :qualification, + :completed, + application_form:, + title: "BSc Teaching", + ) + assessment = create(:assessment, :verify, application_form:) + create( + :consent_request, + :received, + :expired, + assessment:, + verify_passed: false, + qualification:, + ) + application_form + end + end + + delegate :reference, to: :application_form + + def assessment_id + application_form.assessment.id + end +end