Skip to content

Commit

Permalink
Add request Ecctis verification page
Browse files Browse the repository at this point in the history
This adds the page which allows admins to mark that they have requested
verification with Ecctis.
  • Loading branch information
thomasleese committed Feb 29, 2024
1 parent 87a0c9f commit b2c5c25
Show file tree
Hide file tree
Showing 19 changed files with 221 additions and 54 deletions.
9 changes: 3 additions & 6 deletions app/components/status_tag/component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,18 @@ def tags
not_started: "grey",
overdue: "pink",
overdue_consent: "pink",
overdue_ecctis: "pink",
overdue_further_information: "pink",
overdue_lops: "pink",
overdue_professional_standing: "pink",
overdue_qualification: "pink",
overdue_reference: "pink",
potential_duplicate_in_dqt: "pink",
pre_assessment: "pink",
preliminary_check: "pink",
received: "purple",
received_consent: "purple",
received_ecctis: "purple",
received_further_information: "purple",
received_lops: "purple",
received_professional_standing: "purple",
received_qualification: "purple",
received_reference: "purple",
rejected: "red",
requested: "yellow",
Expand All @@ -63,10 +61,9 @@ def tags
verification_not_started: "grey",
waiting_on: "yellow",
waiting_on_consent: "yellow",
waiting_on_ecctis: "yellow",
waiting_on_further_information: "yellow",
waiting_on_lops: "yellow",
waiting_on_professional_standing: "yellow",
waiting_on_qualification: "yellow",
waiting_on_reference: "yellow",
withdrawn: "red",
}.freeze
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class QualificationRequestsController < BaseController
update
edit_consent_method
update_consent_method
edit_request
update_request
edit_review
update_review
]
Expand Down Expand Up @@ -168,6 +170,37 @@ def update_consent_method
end
end

def edit_request
@form =
RequestableRequestForm.new(
requestable:,
user: current_staff,
passed: qualification_request.requested?,
)
end

def update_request
@form =
RequestableRequestForm.new(
requestable:,
user: current_staff,
passed:
params.dig(:assessor_interface_requestable_request_form, :passed) ||
false,
)

if @form.save
redirect_to [
:assessor_interface,
application_form,
assessment,
:qualification_requests,
]
else
render :edit_request, status: :unprocessable_entity
end
end

def edit_review
@form = RequestableReviewForm.new(requestable:)
end
Expand Down
22 changes: 11 additions & 11 deletions app/lib/application_form_status_updater.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ def action_required_by
application_form.awarded_at.present?
"none"
elsif dqt_trn_request.present? || assessment_in_review? ||
overdue_further_information || overdue_qualification ||
received_further_information || received_qualification
overdue_further_information || overdue_ecctis ||
received_further_information || received_ecctis
"assessor"
elsif preliminary_check? || need_to_request_lops? || overdue_consent ||
received_consent || overdue_lops || received_lops ||
overdue_reference || received_reference
"admin"
elsif waiting_on_consent || waiting_on_further_information ||
waiting_on_lops || waiting_on_qualification || waiting_on_reference
waiting_on_lops || waiting_on_ecctis || waiting_on_reference
"external"
elsif application_form.submitted_at.present?
"assessor"
Expand All @@ -81,10 +81,10 @@ def stage
(teaching_authority_provides_written_statement && waiting_on_lops)
"pre_assessment"
elsif assessment_in_verify? || need_to_request_lops? || overdue_consent ||
overdue_lops || overdue_qualification || overdue_reference ||
received_consent || received_lops || received_qualification ||
overdue_lops || overdue_ecctis || overdue_reference ||
received_consent || received_lops || received_ecctis ||
received_reference || waiting_on_consent || waiting_on_lops ||
waiting_on_qualification || waiting_on_reference
waiting_on_ecctis || waiting_on_reference
"verification"
elsif overdue_further_information || received_further_information ||
waiting_on_further_information ||
Expand Down Expand Up @@ -166,7 +166,7 @@ def need_to_request_lops?
def requestable_statuses
@requestable_statuses ||=
%w[overdue received waiting_on]
.product(%w[consent further_information lops qualification reference])
.product(%w[consent ecctis further_information lops reference])
.map { |status, requestable| "#{status}_#{requestable}" }
.filter { |column| send(column) }
end
Expand All @@ -184,8 +184,8 @@ def overdue_lops
overdue?(requestables: professional_standing_requests)
end

def overdue_qualification
overdue?(requestables: qualification_requests.select(&:requested?))
def overdue_ecctis
overdue?(requestables: qualification_requests)
end

def overdue_reference
Expand All @@ -205,7 +205,7 @@ def received_lops
received?(requestables: professional_standing_requests)
end

def received_qualification
def received_ecctis
received?(requestables: qualification_requests)
end

Expand Down Expand Up @@ -245,7 +245,7 @@ def waiting_on_lops
waiting_on?(requestables: professional_standing_requests)
end

def waiting_on_qualification
def waiting_on_ecctis
waiting_on?(requestables: qualification_requests)
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ def update_consent_method?

alias_method :edit_consent_method?, :update_consent_method?

def update_request?
user.verify_permission
end

alias_method :edit_request?, :update_request?

def update_review?
user.assess_permission
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,16 @@ def ecctis_task_items(qualification_request)
[
{
name: "Request Ecctis verification",
link: "#",
link:
if can_start && !qualification_request.requested?
[
:request,
:assessor_interface,
application_form,
assessment,
qualification_request,
]
end,
status:
if can_start
qualification_request.requested? ? "completed" : "not_started"
Expand All @@ -255,7 +264,7 @@ def ecctis_task_items(qualification_request)
link: "#",
status:
if can_start && qualification_request.requested?
qualification_request.received? ? "completed" : "not_started"
qualification_request.received? ? "completed" : "waiting_on"
else
"cannot_start"
end,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</ul>

<%= f.govuk_check_boxes_fieldset :passed, multiple: false, legend: { text: "Confirm you have requested verification for this LoPS", size: "s" } do %>
<%= f.govuk_check_box :passed, true, false, multiple: false, link_errors: true, label: { text: "Verification has been requested." } %>
<%= f.govuk_check_box :passed, true, false, link_errors: true, label: { text: "Verification has been requested." } %>
<% end %>

<%= render "shared/assessor_interface/continue_cancel_button", f: %>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<% title = "Request Ecctis verification" %>

<% content_for :page_title, title_with_error_prefix(title, error: @form.errors.any?) %>
<% content_for :back_link_url, back_history_path(default: assessor_interface_application_form_path(@application_form)) %>

<%= form_with model: @form, url: [:request, :assessor_interface, @application_form, @assessment, @qualification_request] do |f| %>
<h1 class="govuk-heading-xl"><%= title %></h1>

<%= f.govuk_check_boxes_fieldset :passed, multiple: false, legend: { text: "Confirm you have requested verification for this qualification", size: "s" } do %>
<%= f.govuk_check_box :passed, true, false, link_errors: true, label: { text: "Verification has been requested." } %>
<% end %>

<%= render "shared/assessor_interface/continue_cancel_button", f: %>
<% end %>
15 changes: 6 additions & 9 deletions config/locales/components.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,19 @@ en:
not_started: Not started
overdue: Overdue
overdue_consent: Overdue consent
overdue_ecctis: Overdue Ecctis
overdue_further_information: Overdue further information
overdue_lops: Overdue LOPS
overdue_professional_standing: Overdue professional standing
overdue_qualification: Overdue qualification
overdue_lops: Overdue LoPS
overdue_reference: Overdue reference
potential_duplicate_in_dqt: Potential duplication in DQT
pre_assessment: Pre-assessment
preliminary_check: Preliminary check
received: Received
received_and_overdue: Received (overdue)
received_consent: Received consent
received_ecctis: Received Ecctis
received_further_information: Received further information
received_lops: Received LOPS
received_professional_standing: Received professional standing
received_qualification: Received qualification
received_lops: Received LoPS
received_reference: Received reference
rejected: Rejected
requested: Waiting on
Expand All @@ -43,10 +41,9 @@ en:
verification_not_started: Verification not started
waiting_on: Waiting on
waiting_on_consent: Waiting on consent
waiting_on_ecctis: Waiting on Ecctis
waiting_on_further_information: Waiting on further information
waiting_on_lops: Waiting on LOPS
waiting_on_professional_standing: Waiting on professional standing
waiting_on_qualification: Waiting on qualification
waiting_on_lops: Waiting on LoPS
waiting_on_reference: Waiting on reference
withdrawn: Withdrawn

Expand Down
3 changes: 2 additions & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@
to: "qualification_requests#edit_consent_method"
post "consent-method",
to: "qualification_requests#update_consent_method"

get "request", to: "qualification_requests#edit_request"
post "request", to: "qualification_requests#update_request"
get "review", to: "qualification_requests#edit_review"
post "review", to: "qualification_requests#update_review"
end
Expand Down
4 changes: 2 additions & 2 deletions spec/lib/application_form_status_updater_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@

include_examples "changes action required by", "assessor"
include_examples "changes stage", "verification"
include_examples "changes statuses", %w[received_qualification]
include_examples "changes statuses", %w[received_ecctis]
end

context "with a requested qualification request" do
Expand All @@ -217,7 +217,7 @@

include_examples "changes action required by", "external"
include_examples "changes stage", "verification"
include_examples "changes statuses", %w[waiting_on_qualification]
include_examples "changes statuses", %w[waiting_on_ecctis]
end

context "with a received reference request" do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,16 @@
it_behaves_like "a policy method requiring the verify permission"
end

describe "#update_request?" do
subject(:update_request?) { policy.update_request? }
it_behaves_like "a policy method requiring the verify permission"
end

describe "#edit_request?" do
subject(:edit_request?) { policy.edit_request? }
it_behaves_like "a policy method requiring the verify permission"
end

describe "#update_review?" do
subject(:update_review?) { policy.update_review? }
it_behaves_like "a policy method requiring the assess permission"
Expand Down
2 changes: 1 addition & 1 deletion spec/services/receive_requestable_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

it "changes the application form status" do
expect { call }.to change { application_form.reload.statuses }.to(
%w[received_qualification],
%w[received_ecctis],
)
end

Expand Down
2 changes: 1 addition & 1 deletion spec/services/unreceive_requestable_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

RSpec.describe UnreceiveRequestable do
let(:application_form) do
create(:application_form, :submitted, statuses: %w[received_qualification])
create(:application_form, :submitted, statuses: %w[received_ecctis])
end
let(:requestable) do
create(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,9 @@

module PageObjects
module AssessorInterface
class RequestProfessionalStandingRequest < SitePrism::Page
class RequestProfessionalStandingRequest < RequestRequestablePage
set_url "/assessor/applications/{reference}/assessments/{assessment_id}" \
"/professional-standing-request/request"

section :form, "form" do
element :passed_checkbox,
"#assessor-interface-requestable-request-form-passed-true-field",
visible: false
element :submit_button, ".govuk-button"
end

def submit_checked
form.passed_checkbox.click
form.submit_button.click
end

def submit_unchecked
form.submit_button.click
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# frozen_string_literal: true

module PageObjects
module AssessorInterface
class RequestQualificationRequest < RequestRequestablePage
set_url "/assessor/applications/{reference}/assessments/{assessment_id}" \
"/qualification-requests/{id}/request"
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# frozen_string_literal: true

module PageObjects
module AssessorInterface
class RequestRequestablePage < SitePrism::Page
section :form, "form" do
element :passed_checkbox,
"#assessor-interface-requestable-request-form-passed-true-field",
visible: false
element :submit_button, ".govuk-button"
end

def submit_checked
form.passed_checkbox.click
form.submit_button.click
end

def submit_unchecked
form.submit_button.click
end
end
end
end
5 changes: 5 additions & 0 deletions spec/support/page_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,11 @@ def assessor_request_professional_standing_request_page
PageObjects::AssessorInterface::RequestProfessionalStandingRequest.new
end

def assessor_request_qualification_request_page
@assessor_request_qualification_request_page ||=
PageObjects::AssessorInterface::RequestQualificationRequest.new
end

def assessor_reverse_decision_page
@assessor_reverse_decision_page ||=
PageObjects::AssessorInterface::ReverseDecision.new
Expand Down
Loading

0 comments on commit b2c5c25

Please sign in to comment.