Skip to content

Commit

Permalink
Add review task list items
Browse files Browse the repository at this point in the history
This adds a new task list item for assessors for accessing any
verifications that need reviewing.
  • Loading branch information
thomasleese committed Oct 5, 2023
1 parent e47ea99 commit 28b8927
Show file tree
Hide file tree
Showing 3 changed files with 140 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def task_list_sections
pre_assessment_task_list_section,
assessment_task_list_section,
verification_task_list_section,
review_task_list_section,
].compact
end

Expand Down Expand Up @@ -83,7 +84,10 @@ def management_tasks
:teaching_authority_provides_written_statement,
:work_histories,
to: :application_form
delegate :professional_standing_request, to: :assessment
delegate :professional_standing_request,
:qualification_requests,
:reference_requests,
to: :assessment
delegate :canonical_email, to: :teacher

def pre_assessment_task_list_section
Expand Down Expand Up @@ -254,7 +258,7 @@ def verification_task_list_section
review_professional_standing_request_task_list_item,
].compact

items << assessment_recommendation_task_list_item if items.present?
items << verification_decision_task_list_item if items.present?

{
title:
Expand Down Expand Up @@ -312,27 +316,6 @@ def reference_requests_task_list_item
}
end

def assessment_recommendation_task_list_item
{
name:
I18n.t(
"assessor_interface.application_forms.show.assessment_tasks.items.assessment_recommendation",
),
link:
if assessment.recommendable?
[:edit, :assessor_interface, application_form, assessment]
end,
status:
if assessment.completed?
:completed
elsif !assessment.recommendable?
:cannot_start
else
:not_started
end,
}
end

def locate_professional_standing_request_task_list_item
if teaching_authority_provides_written_statement ||
professional_standing_request.blank?
Expand Down Expand Up @@ -397,6 +380,92 @@ def review_professional_standing_request_task_list_item
}
end

def verification_decision_task_list_item
{
name:
I18n.t(
"assessor_interface.application_forms.show.assessment_tasks.items.verification_decision",
),
link:
if assessment.verify? && assessment.recommendable?
[:edit, :assessor_interface, application_form, assessment]
end,
status:
if assessment.review? || assessment.completed?
:completed
elsif !assessment.recommendable?
:cannot_start
else
:not_started
end,
}
end

def review_task_list_section
return unless pre_assessment_complete?
return if assessment.verify?

if (
!teaching_authority_provides_written_statement &&
professional_standing_request&.verify_failed?
) || qualification_requests.any?(&:verify_failed?) ||
reference_requests.any?(&:verify_failed?)
{
title:
I18n.t(
"assessor_interface.application_forms.show.assessment_tasks.sections.review",
),
items: [
review_verifications_task_list_item,
review_decision_task_list_item,
],
}
end
end

def review_verifications_task_list_item
{
name:
I18n.t(
"assessor_interface.application_forms.show.assessment_tasks.items.review_verifications",
),
link: [:edit, :assessor_interface, application_form, assessment],
status:
if assessment.recommendable?
:completed
elsif (
!teaching_authority_provides_written_statement &&
professional_standing_request&.reviewed?
) || qualification_requests.any?(&:reviewed?) ||
reference_requests.any?(&:reviewed?)
:in_progress
else
:not_started
end,
}
end

def review_decision_task_list_item
{
name:
I18n.t(
"assessor_interface.application_forms.show.assessment_tasks.items.assessment_decision",
),
link:
if assessment.recommendable?
[:edit, :assessor_interface, application_form, assessment]
end,
status:
if assessment.completed?
:completed
elsif !assessment.recommendable?
:cannot_start
else
:not_started
end,
}
end

def pre_assessment_complete?
return false unless assessment.all_preliminary_sections_passed?

Expand Down
5 changes: 4 additions & 1 deletion config/locales/assessor_interface.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,19 @@ en:
sections:
assessment: Assessment
pre_assessment_tasks: Pre-assessment tasks
review: Review
verification: Verification
items:
assessment_recommendation: Assessment recommendation
assessment_decision: Assessment decision
await_professional_standing_request: Awaiting third-party professional standing
initial_assessment_recommendation: Initial assessment recommendation
locate_professional_standing_request: Record LOPS response
qualification_requests: Record qualifications responses
reference_requests: Verify reference requests
review_professional_standing_request: Review LOPS response
review_requested_information: Review requested information from applicant
review_verifications: Review verifications
verification_decision: Verification decision

assessments:
edit:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@
it do
is_expected.to include_task_list_item(
"Verification",
"Assessment recommendation",
"Verification decision",
)
end
end
Expand All @@ -393,7 +393,7 @@
it do
is_expected.to include_task_list_item(
"Verification",
"Assessment recommendation",
"Verification decision",
)
end
end
Expand All @@ -410,10 +410,51 @@
it do
is_expected.to include_task_list_item(
"Verification",
"Assessment recommendation",
"Verification decision",
)
end
end

context "with a failed verified professional standing request" do
before do
create(
:professional_standing_request,
assessment:,
verify_passed: false,
)
end

it do
is_expected.to include_task_list_item("Review", "Review verifications")
end
it do
is_expected.to include_task_list_item("Review", "Assessment decision")
end
end

context "with a failed verified qualification request" do
before do
create(:qualification_request, assessment:, verify_passed: false)
end

it do
is_expected.to include_task_list_item("Review", "Review verifications")
end
it do
is_expected.to include_task_list_item("Review", "Assessment decision")
end
end

context "with a failed verified reference request" do
before { create(:reference_request, assessment:, verify_passed: false) }

it do
is_expected.to include_task_list_item("Review", "Review verifications")
end
it do
is_expected.to include_task_list_item("Review", "Assessment decision")
end
end
end

describe "#email_used_as_reference_in_this_application_form?" do
Expand Down

0 comments on commit 28b8927

Please sign in to comment.