diff --git a/app/controllers/assessor_interface/qualification_requests_controller.rb b/app/controllers/assessor_interface/qualification_requests_controller.rb index d9776d730f..49da2eb45b 100644 --- a/app/controllers/assessor_interface/qualification_requests_controller.rb +++ b/app/controllers/assessor_interface/qualification_requests_controller.rb @@ -8,13 +8,10 @@ class QualificationRequestsController < BaseController define_history_origin :index def index - authorize %i[assessor_interface qualification_request] - - @qualification_requests = qualification_requests - @application_form = qualification_requests.first.application_form - @assessment = qualification_requests.first.assessment - - render layout: "full_from_desktop" + @view_object = + AssessorInterface::QualificationRequestsViewObject.new( + application_form:, + ) end def consent_letter diff --git a/app/views/assessor_interface/qualification_requests/index.html.erb b/app/views/assessor_interface/qualification_requests/index.html.erb index d844c06a7e..560c3d7253 100644 --- a/app/views/assessor_interface/qualification_requests/index.html.erb +++ b/app/views/assessor_interface/qualification_requests/index.html.erb @@ -1,22 +1,34 @@ <% content_for :page_title, t("assessor_interface.application_forms.show.assessment_tasks.items.qualification_requests") %> <% content_for :back_link_url, back_history_path(default: assessor_interface_application_form_path(@application_form)) %> -<%= render "shared/assessor_header", title: t("assessor_interface.application_forms.show.assessment_tasks.items.qualification_requests"), application_form: @application_form %> - -<%= render TaskList::Component.new( - [ - { - title: "Qualifications", - indentation: false, - items: @qualification_requests.map do |qualification_request| - { - name: qualification_title(qualification_request.qualification), - link: [:edit, :assessor_interface, @application_form, @assessment, qualification_request], - status: qualification_request.status - } - end - } - ] -) %> +

<%= t("assessor_interface.application_forms.show.assessment_tasks.items.qualification_requests") %>

+ +

All qualifications

+ +

Complete the following tasks for each qualification:

+ +<%= render TaskList::Component.new([ + { + indentation: false, + items: @view_object.all_task_items + } +]) %> + +<% if @view_object.show_individual_task_items? %> +

Qualification specific

+ +

As you have to verify more than one qualification you will need to complete specific tasks for each one.

+ + <% @view_object.qualification_requests.map do |qualification_request| %> +

<%= qualification_title(qualification_request.qualification) %>

+ + <%= render TaskList::Component.new([ + { + indentation: false, + items: @view_object.individual_task_items_for(qualification_request:) + } + ]) %> + <% end %> +<% end %> <%= govuk_button_link_to "Back to overview", [:assessor_interface, @application_form] %> diff --git a/spec/factories/assessments.rb b/spec/factories/assessments.rb index ac4c00d259..8c7c83a68a 100644 --- a/spec/factories/assessments.rb +++ b/spec/factories/assessments.rb @@ -131,7 +131,6 @@ after(:create) do |assessment, _evaluator| create( :qualification_request, - :requested, assessment:, qualification: assessment.application_form.qualifications.first, ) diff --git a/spec/system/assessor_interface/verifying_qualifications_spec.rb b/spec/system/assessor_interface/verifying_qualifications_spec.rb index 4ad6f1c000..78b205d8d2 100644 --- a/spec/system/assessor_interface/verifying_qualifications_spec.rb +++ b/spec/system/assessor_interface/verifying_qualifications_spec.rb @@ -9,68 +9,13 @@ given_there_is_an_application_form_with_qualification_request end - it "received and passed" do + it "check and select consent method" do when_i_visit_the(:assessor_application_page, reference:) - and_i_see_a_waiting_on_status and_i_click_the_verify_qualifications_task then_i_see_the(:assessor_qualification_requests_page, reference:) - when_i_select_the_first_qualification_request - then_i_see_the(:assessor_edit_qualification_request_page, reference:) - - when_the_request_is_received_and_passed - then_i_see_the(:assessor_qualification_requests_page, reference:) - - when_i_go_back_to_overview - and_i_see_an_in_progress_status - end - - it "received and not passed" do - when_i_visit_the(:assessor_application_page, reference:) - and_i_see_a_waiting_on_status - and_i_click_the_verify_qualifications_task - then_i_see_the(:assessor_qualification_requests_page, reference:) - - when_i_select_the_first_qualification_request - then_i_see_the(:assessor_edit_qualification_request_page, reference:) - - when_the_request_is_received_and_not_passed - then_i_see_the(:assessor_qualification_requests_page, reference:) - - when_i_go_back_to_overview - and_i_see_an_in_progress_status - end - - it "not received and failed" do - when_i_visit_the(:assessor_application_page, reference:) - and_i_see_a_waiting_on_status - and_i_click_the_verify_qualifications_task - then_i_see_the(:assessor_qualification_requests_page, reference:) - - when_i_select_the_first_qualification_request - then_i_see_the(:assessor_edit_qualification_request_page, reference:) - - when_the_request_is_not_received_and_failed - then_i_see_the(:assessor_qualification_requests_page, reference:) - when_i_go_back_to_overview - and_i_see_an_in_progress_status - end - - it "not received and not failed" do - when_i_visit_the(:assessor_application_page, reference:) - and_i_see_a_waiting_on_status - and_i_click_the_verify_qualifications_task - then_i_see_the(:assessor_qualification_requests_page, reference:) - - when_i_select_the_first_qualification_request - then_i_see_the(:assessor_edit_qualification_request_page, reference:) - - when_the_request_is_not_received_and_not_failed - then_i_see_the(:assessor_qualification_requests_page, reference:) - - when_i_go_back_to_overview - and_i_see_a_waiting_on_status + then_i_see_the(:assessor_application_page, reference:) end private @@ -79,57 +24,10 @@ def given_there_is_an_application_form_with_qualification_request application_form end - def and_i_see_a_waiting_on_status - expect(assessor_application_page.status_summary.value).to have_text( - "WAITING ON QUALIFICATION", - ) - end - def and_i_click_the_verify_qualifications_task assessor_application_page.verify_qualifications_task.link.click end - def when_i_select_the_first_qualification_request - assessor_qualification_requests_page - .task_list - .qualification_requests - .first - .click - end - - def when_the_request_is_received_and_passed - form = assessor_edit_qualification_request_page.form - - form.received_true_radio_item.choose - form.passed_true_radio_item.choose - form.submit_button.click - end - - def when_the_request_is_received_and_not_passed - form = assessor_edit_qualification_request_page.form - - form.received_true_radio_item.choose - form.passed_false_radio_item.choose - form.note_field.fill_in with: "Note." - form.submit_button.click - end - - def when_the_request_is_not_received_and_failed - form = assessor_edit_qualification_request_page.form - - form.received_false_radio_item.choose - form.failed_true_radio_item.choose - form.submit_button.click - end - - def when_the_request_is_not_received_and_not_failed - form = assessor_edit_qualification_request_page.form - - form.received_false_radio_item.choose - form.failed_false_radio_item.choose - form.submit_button.click - end - def when_i_go_back_to_overview assessor_qualification_requests_page.continue_button.click end @@ -140,25 +38,20 @@ def and_i_see_a_received_status ) end - def and_i_see_an_in_progress_status - expect(assessor_application_page.status_summary.value).to have_text( - "ASSESSMENT IN PROGRESS", - ) - end - def application_form @application_form ||= - begin - application_form = - create( - :application_form, - :submitted, - statuses: %w[waiting_on_qualification], - ) - qualification = create(:qualification, :completed, application_form:) - assessment = create(:assessment, :started, application_form:) - create(:qualification_request, :requested, assessment:, qualification:) - application_form + create( + :application_form, + :submitted, + :verification_stage, + :with_teaching_qualification, + ).tap do |application_form| + create( + :assessment, + :started, + :with_qualification_request, + application_form:, + ) end end