diff --git a/app/components/status_tag/component.rb b/app/components/status_tag/component.rb index ce7498cc57..38d6365775 100644 --- a/app/components/status_tag/component.rb +++ b/app/components/status_tag/component.rb @@ -53,7 +53,7 @@ def tags received_reference: "purple", rejected: "red", requested: "yellow", - review: "purple", + review: "pink", submitted: "grey", valid: "green", verification: "yellow", diff --git a/app/controllers/assessor_interface/review_verifications_controller.rb b/app/controllers/assessor_interface/review_verifications_controller.rb index c50468cbe9..786f1c6f56 100644 --- a/app/controllers/assessor_interface/review_verifications_controller.rb +++ b/app/controllers/assessor_interface/review_verifications_controller.rb @@ -10,6 +10,8 @@ def index @professional_standing_request = assessment.professional_standing_request if assessment.professional_standing_request.verify_failed? + + render layout: "full_from_desktop" end private diff --git a/app/helpers/region_helper.rb b/app/helpers/region_helper.rb index 6368cef49e..c0f545bfb4 100644 --- a/app/helpers/region_helper.rb +++ b/app/helpers/region_helper.rb @@ -12,7 +12,7 @@ def region_certificate_phrase(region) end def region_teaching_authority_name(region) - region.teaching_authority_name.presence || "teaching authority" + region.teaching_authority_name.presence || "relevant competent authority" end def region_teaching_authority_name_phrase(region) diff --git a/app/models/assessment.rb b/app/models/assessment.rb index ed1dfa3180..ea2270278c 100644 --- a/app/models/assessment.rb +++ b/app/models/assessment.rb @@ -98,7 +98,9 @@ def can_award? all_qualification_requests_review_passed? && professional_standing_request_verify_passed? elsif review? - professional_standing_request_review_passed? + enough_reference_requests_review_passed? && + all_qualification_requests_review_passed? && + professional_standing_request_review_passed? else false end @@ -112,13 +114,29 @@ def can_decline? any_preliminary_section_failed? || (all_sections_finished? && any_section_failed? && any_section_declines?) elsif request_further_information? - any_further_information_request_failed? - elsif review? - professional_standing_request_review_failed? + all_further_information_requests_reviewed? && + any_further_information_requests_failed? elsif verify? - enough_reference_requests_reviewed? && - all_qualification_requests_reviewed? && - professional_standing_request_verified? && !can_review? && !can_award? + return false if professional_standing_request_verify_failed? + + unless enough_reference_requests_reviewed? && + all_qualification_requests_reviewed? && + professional_standing_request_verify_passed? + return false + end + + !enough_reference_requests_review_passed? || + any_qualification_requests_review_failed? + elsif review? + unless enough_reference_requests_reviewed? && + all_qualification_requests_reviewed? && + professional_standing_request_reviewed? + return false + end + + !enough_reference_requests_review_passed? || + any_qualification_requests_review_failed? || + professional_standing_request_review_failed? else false end @@ -206,14 +224,22 @@ def no_section_declines? sections.none?(&:declines_assessment?) end + def all_further_information_requests_reviewed? + further_information_requests.present? && + further_information_requests.all?(&:reviewed?) + end + def all_further_information_requests_passed? further_information_requests.present? && further_information_requests.all?(&:review_passed?) end - def any_further_information_request_failed? - further_information_requests.present? && - further_information_requests.any?(&:review_failed?) + def any_further_information_requests_failed? + further_information_requests.any?(&:review_failed?) + end + + def enough_reference_requests_reviewed? + references_verified || reference_requests.empty? end def enough_reference_requests_review_passed? @@ -234,48 +260,37 @@ def enough_reference_requests_review_passed? months_count >= 9 end - def enough_reference_requests_reviewed? - references_verified || reference_requests.empty? + def all_qualification_requests_reviewed? + qualification_requests.all?(&:reviewed?) end def all_qualification_requests_review_passed? - if qualification_requests.present? - qualification_requests.all?(&:review_passed?) - else - true - end + qualification_requests.all?(&:review_passed?) end - def all_qualification_requests_reviewed? - if qualification_requests.present? - qualification_requests.all?(&:reviewed?) - else - true - end + def any_qualification_requests_review_failed? + qualification_requests.any?(&:review_failed?) end - def professional_standing_request_review_passed? + def professional_standing_request_reviewed? if professional_standing_request_part_of_verification? - professional_standing_request.review_passed? + professional_standing_request.reviewed? else true end end - def professional_standing_request_verified? + def professional_standing_request_review_passed? if professional_standing_request_part_of_verification? - professional_standing_request.verified? + professional_standing_request.review_passed? else true end end def professional_standing_request_review_failed? - if professional_standing_request_part_of_verification? + professional_standing_request_part_of_verification? && professional_standing_request.review_failed? - else - false - end end def professional_standing_request_verify_passed? @@ -287,11 +302,8 @@ def professional_standing_request_verify_passed? end def professional_standing_request_verify_failed? - if professional_standing_request_part_of_verification? + professional_standing_request_part_of_verification? && professional_standing_request.verify_failed? - else - false - end end def professional_standing_request_part_of_verification? diff --git a/app/models/concerns/requestable.rb b/app/models/concerns/requestable.rb index 6889e0131d..bd4ebc49c8 100644 --- a/app/models/concerns/requestable.rb +++ b/app/models/concerns/requestable.rb @@ -60,7 +60,7 @@ def verify_failed? def status if verify_passed? || review_passed? - "accepted" + "completed" elsif review_failed? "rejected" elsif verify_failed? diff --git a/app/views/assessor_interface/application_forms/status.html.erb b/app/views/assessor_interface/application_forms/status.html.erb index c222ce63d1..ca7c7ce383 100644 --- a/app/views/assessor_interface/application_forms/status.html.erb +++ b/app/views/assessor_interface/application_forms/status.html.erb @@ -9,10 +9,6 @@ <%= govuk_panel(title_text: "QTS application #{@view_object.application_form.reference} has been #{@view_object.status.downcase}") %> <% end %> -<% unless @view_object.application_form.waiting_on? %> -

The status of this application has been changed to ’<%= @view_object.status %>‘.

-<% end %> - <% if @view_object.assessment.review? %>

An assessor will now review the application and make a decision on awarding or declining QTS.

<% elsif @view_object.application_form.declined? %> diff --git a/app/views/assessor_interface/assessment_recommendation_verify/edit_professional_standing.html.erb b/app/views/assessor_interface/assessment_recommendation_verify/edit_professional_standing.html.erb index 5cec798e4f..55e7099814 100644 --- a/app/views/assessor_interface/assessment_recommendation_verify/edit_professional_standing.html.erb +++ b/app/views/assessor_interface/assessment_recommendation_verify/edit_professional_standing.html.erb @@ -6,7 +6,7 @@

<%= t(".heading") %>

-

If you choose to verify this applicant’s letter of professional standing, you’ll need to email the competent authority directly, then come back to record the outcome.

+

If you choose to verify this application's LoPS an admin will email the competent authority and record the response.

<%= f.govuk_collection_radio_buttons :verify_professional_standing, %i[true false], :itself, legend: nil %> diff --git a/app/views/assessor_interface/professional_standing_requests/show.html.erb b/app/views/assessor_interface/professional_standing_requests/show.html.erb index 4b864737bd..cd21887ef4 100644 --- a/app/views/assessor_interface/professional_standing_requests/show.html.erb +++ b/app/views/assessor_interface/professional_standing_requests/show.html.erb @@ -4,7 +4,7 @@

Verify LoPS

- You need to request verification for this applications LoPS. Follow the steps below: + You need to request verification for this application’s LoPS.

<%= render(TaskList::Component.new( diff --git a/app/views/assessor_interface/review_verifications/index.html.erb b/app/views/assessor_interface/review_verifications/index.html.erb index 3afc20c8d4..851ca653d2 100644 --- a/app/views/assessor_interface/review_verifications/index.html.erb +++ b/app/views/assessor_interface/review_verifications/index.html.erb @@ -3,16 +3,27 @@

Review verifications

-<%= govuk_table do |table| +

+ The following verification tasks have been flagged for review: +

+ +<%= render(TaskList::Component.new( if @professional_standing_request.present? - table.with_caption(text: "LoPS") - table.with_body do |body| - body.with_row do |row| - row.with_cell { govuk_link_to region_certificate_name(@application_form.region), [:review, :assessor_interface, @application_form, @assessment, :professional_standing_request] } - row.with_cell { render(StatusTag::Component.new(@professional_standing_request.review_status)) } - end - end + [ + { + title: "LoPS", + items: [ + { + name: region_teaching_authority_name(@application_form.region).upcase_first, + link: [:review, :assessor_interface, @application_form, @assessment, :professional_standing_request], + status: @professional_standing_request.review_status, + } + ], + } + ] end -end %> +)) %> -<%= govuk_button_link_to "Back to overview", [:assessor_interface, @application_form] %> +
+ <%= govuk_button_link_to "Back to overview", [:assessor_interface, @application_form] %> +
diff --git a/spec/mailers/teacher_mailer_spec.rb b/spec/mailers/teacher_mailer_spec.rb index f769c2c383..8ed4f5c547 100644 --- a/spec/mailers/teacher_mailer_spec.rb +++ b/spec/mailers/teacher_mailer_spec.rb @@ -377,7 +377,8 @@ it do is_expected.to include( "Thank you for requesting your letter that proves you’re recognised as a teacher from " \ - "the teaching authority. We have now received this document and attached it to your application.", + "the relevant competent authority. We have now received this document and attached it " \ + "to your application.", ) end end diff --git a/spec/models/assessment_spec.rb b/spec/models/assessment_spec.rb index 4f27d29499..4665ef92aa 100644 --- a/spec/models/assessment_spec.rb +++ b/spec/models/assessment_spec.rb @@ -283,7 +283,7 @@ context "when awarded pending verification" do before { assessment.verify! } - it { is_expected.to be true } + it { is_expected.to be false } end end diff --git a/spec/support/autoload/page_objects/assessor_interface/complete_assessment.rb b/spec/support/autoload/page_objects/assessor_interface/complete_assessment.rb index 9372b58282..9a1e24be8b 100644 --- a/spec/support/autoload/page_objects/assessor_interface/complete_assessment.rb +++ b/spec/support/autoload/page_objects/assessor_interface/complete_assessment.rb @@ -20,6 +20,12 @@ def request_further_information def decline_qts new_states.find { |radio_item| radio_item.label.text == "Decline QTS" } end + + def send_for_review + new_states.find do |radio_item| + radio_item.label.text == "Send application for review" + end + end end end end diff --git a/spec/support/autoload/page_objects/assessor_interface/review_verifications.rb b/spec/support/autoload/page_objects/assessor_interface/review_verifications.rb index 9543f0947d..18f75cd782 100644 --- a/spec/support/autoload/page_objects/assessor_interface/review_verifications.rb +++ b/spec/support/autoload/page_objects/assessor_interface/review_verifications.rb @@ -6,10 +6,7 @@ class ReviewVerifications < SitePrism::Page set_url "/assessor/applications/{application_form_id}/assessments/{assessment_id}" \ "/review-verifications" - sections :rows, ".govuk-table__row" do - element :link, ".govuk-link" - element :tag, ".govuk-tag" - end + section :task_list, TaskList, ".app-task-list" element :back_to_overview_button, ".govuk-button" end diff --git a/spec/support/shared_examples/requestable.rb b/spec/support/shared_examples/requestable.rb index 9b8327d207..1adef3d687 100644 --- a/spec/support/shared_examples/requestable.rb +++ b/spec/support/shared_examples/requestable.rb @@ -52,7 +52,7 @@ it "is accepted when passed is true" do subject.review_passed = true subject.reviewed_at = Time.zone.now - expect(subject.status).to eq("accepted") + expect(subject.status).to eq("completed") end it "is rejected when passed is false" do diff --git a/spec/system/assessor_interface/reviewing_verifications_spec.rb b/spec/system/assessor_interface/reviewing_professional_standing_spec.rb similarity index 70% rename from spec/system/assessor_interface/reviewing_verifications_spec.rb rename to spec/system/assessor_interface/reviewing_professional_standing_spec.rb index 07c4ce1d13..81c8e90b00 100644 --- a/spec/system/assessor_interface/reviewing_verifications_spec.rb +++ b/spec/system/assessor_interface/reviewing_professional_standing_spec.rb @@ -14,6 +14,18 @@ then_i_see_the(:assessor_application_page, application_form_id:) when_i_click_on_verification_decision + then_i_see_the(:assessor_complete_assessment_page, application_form_id:) + + when_i_select_send_for_review + then_i_see_the( + :assessor_assessment_recommendation_review_page, + application_form_id:, + ) + + when_i_click_continue_from_review + then_i_see_the(:assessor_application_status_page, application_form_id:) + + when_i_click_on_overview_button then_i_see_the(:assessor_application_page, application_form_id:) when_i_click_on_review_verifications @@ -58,12 +70,19 @@ def given_there_is_an_application_form_with_failed_verifications def when_i_click_on_verification_decision assessor_application_page.verification_decision_task.click + end - # TODO: review functionality is not built yet, this page can never be reached - application_form.assessment.review! + def when_i_select_send_for_review + assessor_complete_assessment_page.send_for_review.choose + assessor_complete_assessment_page.continue_button.click + end - # TODO: reload the page - when_i_visit_the(:assessor_application_page, application_form_id:) + 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 @@ -75,7 +94,9 @@ def when_i_click_on_assessment_decision end def when_i_click_on_lops - assessor_review_verifications_page.rows.first.link.click + assessor_application_page.task_list.click_item( + "Relevant competent authority", + ) end def when_i_fill_in_the_review_lops_form @@ -90,15 +111,19 @@ def when_i_click_on_back_to_overview end def and_i_see_the_lops_not_started - expect(assessor_review_verifications_page.rows.first.tag.text).to eq( - "NOT STARTED", - ) + item = + assessor_review_verifications_page.task_list.find_item( + "Relevant competent authority", + ) + expect(item.status_tag.text).to eq("NOT STARTED") end def and_i_see_the_lops_accepted - expect(assessor_review_verifications_page.rows.first.tag.text).to eq( - "ACCEPTED", - ) + item = + assessor_review_verifications_page.task_list.find_item( + "Relevant competent authority", + ) + expect(item.status_tag.text).to eq("ACCEPTED") end def application_form diff --git a/spec/system/assessor_interface/verifying_professional_standing_spec.rb b/spec/system/assessor_interface/verifying_professional_standing_spec.rb index b3a021ac22..b849654fbb 100644 --- a/spec/system/assessor_interface/verifying_professional_standing_spec.rb +++ b/spec/system/assessor_interface/verifying_professional_standing_spec.rb @@ -42,18 +42,18 @@ ) and_the_request_lops_verification_status_is("COMPLETED") - # when_i_click_record_lops_verification - # then_i_see_the( - # :assessor_verify_professional_standing_request_page, - # application_form_id:, - # assessment_id:, - # ) - # and_i_fill_in_the_verify_form - # then_i_see_the( - # :assessor_professional_standing_request_page, - # application_form_id:, - # assessment_id:, - # ) + when_i_click_record_lops_verification + then_i_see_the( + :assessor_verify_professional_standing_request_page, + application_form_id:, + assessment_id:, + ) + and_i_fill_in_the_verify_form + then_i_see_the( + :assessor_professional_standing_request_page, + application_form_id:, + assessment_id:, + ) end private diff --git a/spec/system/assessor_interface/verifying_references_spec.rb b/spec/system/assessor_interface/verifying_references_spec.rb index a1a160b224..dcd3581696 100644 --- a/spec/system/assessor_interface/verifying_references_spec.rb +++ b/spec/system/assessor_interface/verifying_references_spec.rb @@ -117,7 +117,7 @@ def when_i_verify_the_reference_request def then_i_see_the_reference_request_status_is_accepted expect( assessor_reference_requests_page.task_list.status_tags.first.text, - ).to eq("ACCEPTED") + ).to eq("COMPLETED") end def when_i_verify_that_all_references_are_accepted diff --git a/spec/views/teacher_interface/application_forms_show_spec.rb b/spec/views/teacher_interface/application_forms_show_spec.rb index d81c4357db..337e4b179c 100644 --- a/spec/views/teacher_interface/application_forms_show_spec.rb +++ b/spec/views/teacher_interface/application_forms_show_spec.rb @@ -79,7 +79,9 @@ is_expected.to match( /we did not receive your letter that proves you’re recognised as a teacher/, ) - is_expected.to match(/from teaching authority within 180 days/) + is_expected.to match( + /from relevant competent authority within 180 days/, + ) end end