Skip to content

Commit

Permalink
Claim page updates: "Awaiting provider verification" filter, remove "…
Browse files Browse the repository at this point in the history
…Qualification status" column.
  • Loading branch information
alkesh committed Sep 18, 2024
1 parent 16a4daf commit b654659
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 93 deletions.
2 changes: 2 additions & 0 deletions app/forms/admin/claims_filter_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ def claims
Claim.includes(:decisions).held.awaiting_decision
when "failed_bank_validation"
Claim.includes(:decisions).failed_bank_validation.awaiting_decision
when "awaiting_provider_verification"
Claim.awaiting_fe_provider_verification
else
Claim.includes(:decisions).not_held.awaiting_decision
end
Expand Down
1 change: 1 addition & 0 deletions app/helpers/admin/claims_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ def status(claim)
end

STATUS_FILTERS = [
["Awaiting provider verification", "awaiting_provider_verification"],
["Awaiting decision - on hold", "held"],
["Awaiting decision - failed bank details", "failed_bank_validation"],
["Approved awaiting QA", "approved_awaiting_qa"],
Expand Down
4 changes: 4 additions & 0 deletions app/models/claim.rb
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,10 @@ class Claim < ApplicationRecord
scope :not_awaiting_qa, -> { approved.where("qa_required = false OR (qa_required = true AND qa_completed_at IS NOT NULL)") }
scope :awaiting_qa, -> { approved.qa_required.where(qa_completed_at: nil) }
scope :qa_required, -> { where(qa_required: true) }
scope :awaiting_fe_provider_verification, -> do
joins("INNER JOIN further_education_payments_eligibilities ON further_education_payments_eligibilities.id = claims.eligibility_id")
.where("further_education_payments_eligibilities.verification = '{}'")
end

def hold!(reason:, user:)
if holdable? && !held?
Expand Down
2 changes: 0 additions & 2 deletions app/views/admin/claims/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
<th scope="col" class="govuk-table__header">Reference</th>
<th scope="col" class="govuk-table__header">Applicant Name</th>
<th scope="col" class="govuk-table__header">ID Verification</th>
<th scope="col" class="govuk-table__header">Qualification Status</th>
<th scope="col" class="govuk-table__header">Policy</th>
<% if claims_with_warning.nonzero? %>
<th scope="col" class="govuk-table__header">Decision warning</th>
Expand All @@ -74,7 +73,6 @@
<th scope="row" class="govuk-table__header"><%= link_to claim.reference, admin_claim_tasks_path(claim), class: "govuk-link" %></th>
<td class="govuk-table__cell"><%= claim.full_name %></td>
<td class="govuk-table__cell"><%= identity_confirmation_task_claim_verifier_match_status_tag(claim) %></td>
<td class="govuk-table__cell"><%= task_status_tag(claim, "qualifications") %></td>
<td class="govuk-table__cell"><%= I18n.t("#{claim.policy.locale_key}.policy_acronym") %></td>
<% if claims_with_warning.nonzero? %>
<td class="govuk-table__cell"><%= decision_deadline_warning(claim) %></td>
Expand Down
151 changes: 60 additions & 91 deletions spec/features/admin/admin_claims_filtering_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,35 @@
let!(:deleted_user) { create(:dfe_signin_user, :deleted, given_name: "Deleted", family_name: "User", organisation_name: "Department for Education", role_codes: [DfeSignIn::User::SERVICE_OPERATOR_DFE_SIGN_IN_ROLE_CODE]) }
let!(:raj) { create(:dfe_signin_user, given_name: "raj", family_name: "sathikumar", organisation_name: "DfE Payroll", role_codes: [DfeSignIn::User::PAYROLL_OPERATOR_DFE_SIGN_IN_ROLE_CODE]) }

let!(:student_loans_claims_for_mette) { create_list(:claim, 4, :submitted, policy: Policies::StudentLoans, assigned_to: mette) }
let!(:student_loans_claims_for_valentino) { create_list(:claim, 1, :submitted, policy: Policies::StudentLoans, assigned_to: valentino) }
let!(:early_career_payments_claims_for_mary) { create_list(:claim, 2, :submitted, policy: Policies::EarlyCareerPayments, assigned_to: mary) }
let!(:early_career_payments_claims_for_mette) { create_list(:claim, 6, :submitted, policy: Policies::EarlyCareerPayments, assigned_to: mette) }
let!(:early_career_payments_claims_failed_bank_validation) { create_list(:claim, 2, :submitted, :bank_details_not_validated, policy: Policies::EarlyCareerPayments, assigned_to: mette) }
let!(:lup_claims_unassigned) { create_list(:claim, 2, :submitted, policy: Policies::LevellingUpPremiumPayments) }
let!(:held_claims) { create_list(:claim, 2, :submitted, :held) }
let!(:approved_awaiting_qa_claims) { create_list(:claim, 2, :approved, :flagged_for_qa, policy: Policies::LevellingUpPremiumPayments) }
let!(:auto_approved_awaiting_payroll_claims) { create_list(:claim, 2, :auto_approved, policy: Policies::LevellingUpPremiumPayments) }
let!(:approved_claim) { create(:claim, :approved, policy: Policies::LevellingUpPremiumPayments, assigned_to: mette, decision_creator: mary) }
let(:student_loans_claims_for_mette) { create_list(:claim, 4, :submitted, policy: Policies::StudentLoans, assigned_to: mette) }
let(:student_loans_claims_for_valentino) { create_list(:claim, 1, :submitted, policy: Policies::StudentLoans, assigned_to: valentino) }
let(:early_career_payments_claims_for_mary) { create_list(:claim, 2, :submitted, policy: Policies::EarlyCareerPayments, assigned_to: mary) }
let(:early_career_payments_claims_for_mette) { create_list(:claim, 6, :submitted, policy: Policies::EarlyCareerPayments, assigned_to: mette) }
let(:early_career_payments_claims_failed_bank_validation) { create_list(:claim, 2, :submitted, :bank_details_not_validated, policy: Policies::EarlyCareerPayments, assigned_to: mette) }
let(:lup_claims_unassigned) { create_list(:claim, 2, :submitted, policy: Policies::LevellingUpPremiumPayments) }
let(:held_claims) { create_list(:claim, 2, :submitted, :held) }
let(:approved_awaiting_qa_claims) { create_list(:claim, 2, :approved, :flagged_for_qa, policy: Policies::LevellingUpPremiumPayments) }
let(:auto_approved_awaiting_payroll_claims) { create_list(:claim, 2, :auto_approved, policy: Policies::LevellingUpPremiumPayments) }
let(:approved_claim) { create(:claim, :approved, policy: Policies::LevellingUpPremiumPayments, assigned_to: mette, decision_creator: mary) }
let(:further_education_claims_awaiting_provider_verification) { create_list(:claim, 2, :submitted, policy: Policies::FurtherEducationPayments, eligibility_trait: :eligible, assigned_to: valentino) }
let(:rejected_claim) { create(:claim, :rejected, policy: Policies::LevellingUpPremiumPayments, assigned_to: valentino) }

let!(:claims) do
[
student_loans_claims_for_mette,
student_loans_claims_for_valentino,
early_career_payments_claims_for_mary,
early_career_payments_claims_for_mette,
early_career_payments_claims_failed_bank_validation,
lup_claims_unassigned,
held_claims,
approved_awaiting_qa_claims,
auto_approved_awaiting_payroll_claims,
approved_claim,
further_education_claims_awaiting_provider_verification,
rejected_claim
]
end

scenario "the service operator can filter claims by policy" do
student_loan_claims = create_list(:claim, 2, :submitted, policy: Policies::StudentLoans) + student_loans_claims_for_mette + student_loans_claims_for_valentino
Expand All @@ -33,6 +52,7 @@
expect(page.find("table")).to have_content("ECP").exactly(10).times
expect(page.find("table")).to have_content("TSLR").exactly(7).times
expect(page.find("table")).to have_content("LUP").exactly(2).times
expect(page.find("table")).to have_content("FE").exactly(2).times

click_on "View claims"
select "Student Loans", from: "policy"
Expand Down Expand Up @@ -63,28 +83,18 @@
select "Mette Jørgensen", from: "team_member"
click_on "Apply filters"

[
expect_page_to_show_claims(
student_loans_claims_for_mette,
early_career_payments_claims_for_mette,
early_career_payments_claims_failed_bank_validation
].flatten.each do |c|
expect(page).to have_content(c.reference)
end

[
student_loans_claims_for_valentino,
early_career_payments_claims_for_mary,
lup_claims_unassigned
].flatten.each do |c|
expect(page).to_not have_content(c.reference)
end
)

# Assigned to Mette
select "Mette Jørgensen", from: "team_member"
select "Approved", from: "Status:"
click_on "Apply filters"
expect(page).to have_content("1 claim approved")
expect(page).to have_content(approved_claim.reference)
expect_page_to_show_claims(approved_claim)

# Approved by Mary
select "Mary Wasu Wabi", from: "team_member"
Expand All @@ -101,103 +111,62 @@

expect(page.find("table")).to have_content("LUP").exactly(2).times

lup_claims_unassigned.each do |c|
expect(page).to have_content(c.reference)
end

[
student_loans_claims_for_mette,
student_loans_claims_for_valentino,
early_career_payments_claims_for_mary,
early_career_payments_claims_for_mette,
early_career_payments_claims_failed_bank_validation
].flatten.each do |c|
expect(page).to_not have_content(c.reference)
end
expect_page_to_show_claims(lup_claims_unassigned)
end

scenario "filter claims by status" do
click_on "View claims"

held_claims.each do |c|
expect(page).to_not have_content(c.reference)
end

[
expect_page_to_show_claims(
student_loans_claims_for_mette,
student_loans_claims_for_valentino,
early_career_payments_claims_for_mary,
early_career_payments_claims_for_mette,
early_career_payments_claims_failed_bank_validation,
lup_claims_unassigned
].flatten.each do |c|
expect(page).to have_content(c.reference)
end
lup_claims_unassigned,
further_education_claims_awaiting_provider_verification
)

select "Awaiting decision - on hold", from: "Status:"
select "Awaiting provider verification", from: "Status:"
click_button "Apply filters"

held_claims.each do |c|
expect(page).to have_content(c.reference)
end
expect_page_to_show_claims(further_education_claims_awaiting_provider_verification)

[
student_loans_claims_for_mette,
student_loans_claims_for_valentino,
early_career_payments_claims_for_mary,
early_career_payments_claims_for_mette,
early_career_payments_claims_failed_bank_validation,
approved_awaiting_qa_claims,
auto_approved_awaiting_payroll_claims,
lup_claims_unassigned
].flatten.each do |c|
expect(page).not_to have_content(c.reference)
end
select "Awaiting decision - on hold", from: "Status:"
click_button "Apply filters"

expect_page_to_show_claims(held_claims)

select "Awaiting decision - failed bank details", from: "Status:"
click_button "Apply filters"

early_career_payments_claims_failed_bank_validation.each do |c|
expect(page).to have_content(c.reference)
end
expect_page_to_show_claims(early_career_payments_claims_failed_bank_validation)

select "Approved awaiting QA", from: "Status:"
click_button "Apply filters"

approved_awaiting_qa_claims.each do |c|
expect(page).to have_content(c.reference)
end
expect_page_to_show_claims(approved_awaiting_qa_claims)

[
student_loans_claims_for_mette,
student_loans_claims_for_valentino,
early_career_payments_claims_for_mary,
early_career_payments_claims_for_mette,
early_career_payments_claims_failed_bank_validation,
auto_approved_awaiting_payroll_claims,
held_claims,
lup_claims_unassigned
].flatten.each do |c|
expect(page).not_to have_content(c.reference)
end
select "Approved awaiting payroll", from: "Status:"
click_button "Apply filters"
expect_page_to_show_claims(auto_approved_awaiting_payroll_claims, approved_claim)

select "Automatically approved awaiting payroll", from: "Status:"
click_button "Apply filters"

auto_approved_awaiting_payroll_claims.each do |c|
expect_page_to_show_claims(auto_approved_awaiting_payroll_claims)

select "Rejected", from: "Status:"
click_button "Apply filters"
expect_page_to_show_claims(rejected_claim)
end

def expect_page_to_show_claims(*expected_claims)
expected_claims.flatten.each do |c|
expect(page).to have_content(c.reference)
end

[
student_loans_claims_for_mette,
student_loans_claims_for_valentino,
early_career_payments_claims_for_mary,
early_career_payments_claims_for_mette,
early_career_payments_claims_failed_bank_validation,
held_claims,
lup_claims_unassigned
].flatten.each do |c|
expect(page).not_to have_content(c.reference)
(claims - expected_claims).flatten.each do |c|
expect(page).to_not have_content(c.reference)
end
end
end
12 changes: 12 additions & 0 deletions spec/models/claim_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -906,6 +906,18 @@
end
end

describe ".awaiting_fe_provider_verification" do
subject { described_class.awaiting_fe_provider_verification }

let!(:claim_with_fe_provider_verification) { create(:claim, policy: Policies::FurtherEducationPayments, eligibility_trait: :verified) }
let!(:claim_awaiting_fe_provider_verification) { create(:claim, policy: Policies::FurtherEducationPayments, eligibility_trait: :eligible) }
let!(:non_fe_claim) { create(:claim, policy: Policies::StudentLoans) }

it "returns claims that are awaiting FE provider verification" do
is_expected.to match_array([claim_awaiting_fe_provider_verification])
end
end

describe "#amendable?" do
it "returns false for a claim that hasn’t been submitted" do
claim = build(:claim, :submittable)
Expand Down

0 comments on commit b654659

Please sign in to comment.