Skip to content

Commit

Permalink
Show consent requests for review
Browse files Browse the repository at this point in the history
This ensures that consent requests which are due to be reviewed are
shown and visible to the assessor.
  • Loading branch information
thomasleese committed Feb 28, 2024
1 parent 9caa845 commit ffad9d9
Show file tree
Hide file tree
Showing 4 changed files with 144 additions and 5 deletions.
7 changes: 7 additions & 0 deletions app/controllers/assessor_interface/assessments_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
10 changes: 8 additions & 2 deletions app/views/assessor_interface/assessments/review.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
123 changes: 123 additions & 0 deletions spec/system/assessor_interface/reviewing_consent_spec.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit ffad9d9

Please sign in to comment.