Skip to content

Commit

Permalink
Change filter "Awaiting decision - not on hold" to not include claims…
Browse files Browse the repository at this point in the history
… awaiting provider verification
  • Loading branch information
alkesh committed Sep 27, 2024
1 parent c3755af commit df596c3
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 13 deletions.
2 changes: 1 addition & 1 deletion app/forms/admin/claims_filter_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def claims
when "awaiting_provider_verification"
Claim.by_policy(Policies::FurtherEducationPayments).awaiting_further_education_provider_verification
else
Claim.includes(:decisions).not_held.awaiting_decision
Claim.includes(:decisions).not_held.awaiting_decision.not_awaiting_further_education_provider_verification
end

@claims = @claims.by_policy(selected_policy) if selected_policy
Expand Down
3 changes: 3 additions & 0 deletions app/models/claim.rb
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,9 @@ class Claim < ApplicationRecord
.or(Claim.where("further_education_payments_eligibilities.flagged_as_duplicate = TRUE").and(Claim.where(notes: {label: "provider_verification"})))
)
end
scope :not_awaiting_further_education_provider_verification, -> do
where.not(id: Claim.awaiting_further_education_provider_verification)
end

def onelogin_idv_full_name
"#{onelogin_idv_first_name} #{onelogin_idv_last_name}"
Expand Down
4 changes: 3 additions & 1 deletion spec/features/admin/admin_claims_filtering_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
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: :not_verified, assigned_to: valentino) }
let(:further_education_claims_provider_verification_email_not_sent) { create_list(:claim, 2, :submitted, policy: Policies::FurtherEducationPayments, eligibility_trait: :duplicate, assigned_to: valentino) }
let(:rejected_claim) { create(:claim, :rejected, policy: Policies::LevellingUpPremiumPayments, assigned_to: valentino) }

let!(:claims) do
Expand All @@ -38,6 +39,7 @@
auto_approved_awaiting_payroll_claims,
approved_claim,
further_education_claims_awaiting_provider_verification,
further_education_claims_provider_verification_email_not_sent,
rejected_claim
]
end
Expand Down Expand Up @@ -124,7 +126,7 @@
early_career_payments_claims_for_mette,
early_career_payments_claims_failed_bank_validation,
lup_claims_unassigned,
further_education_claims_awaiting_provider_verification
further_education_claims_provider_verification_email_not_sent
)

select "Awaiting provider verification", from: "Status:"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
:claim,
:submitted,
policy: Policies::FurtherEducationPayments,
eligibility_trait: :not_verified
eligibility_trait: :duplicate
)
}
let!(:claim_with_trn) {
Expand All @@ -19,6 +19,14 @@
eligibility: eligibility_with_trn
)
}
let!(:claim_not_verified) {
create(
:claim,
:submitted,
policy: Policies::FurtherEducationPayments,
eligibility_trait: :not_verified
)
}
let!(:claim_with_duplicates_no_provider_email_sent) {
create(
:claim,
Expand Down Expand Up @@ -69,15 +77,15 @@
end

scenario "Awaiting provider verification claim status" do
visit admin_claims_path
find("a[href='#{admin_claim_tasks_path(claim)}']").click
visit admin_claims_path(status: "awaiting_provider_verification")
find("a[href='#{admin_claim_tasks_path(claim_not_verified)}']").click
expect(page).to have_content("Awaiting provider verification")

visit admin_claims_path
find("a[href='#{admin_claim_tasks_path(claim_with_duplicates_no_provider_email_sent)}']").click
expect(page).to have_content("Awaiting decision - not on hold")

visit admin_claims_path
visit admin_claims_path(status: "awaiting_provider_verification")
find("a[href='#{admin_claim_tasks_path(claim_with_duplicates_provider_email_sent)}']").click
expect(page).to have_content("Awaiting provider verification")

Expand Down
36 changes: 29 additions & 7 deletions spec/models/claim_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -906,23 +906,45 @@
end
end

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

describe "awaiting further education provider verification scopes" do
let!(:claim_not_verified_provider_email_automatically_sent) { create(:claim, :submitted, policy: Policies::FurtherEducationPayments, eligibility_trait: :not_verified) }
let!(:claim_not_verified_provider_email_not_sent) { create(:claim, :submitted, policy: Policies::FurtherEducationPayments, eligibility_trait: :duplicate) }
let!(:claim_not_verified_has_duplicates_provider_email_not_sent_has_other_note) { create(:claim, :submitted, policy: Policies::FurtherEducationPayments, eligibility_trait: :duplicate) }
let!(:claim_not_verified_has_duplicates_provider_email_not_sent) { create(:claim, :submitted, policy: Policies::FurtherEducationPayments, eligibility_trait: :duplicate) }
let!(:claim_not_verified_has_duplicates_provider_email_manually_sent) { create(:claim, :submitted, policy: Policies::FurtherEducationPayments, eligibility_trait: :duplicate) }
let!(:claim_with_fe_provider_verification) { create(:claim, policy: Policies::FurtherEducationPayments, eligibility_trait: :verified) }
let!(:non_fe_claim) { create(:claim, policy: Policies::StudentLoans) }

before do
create(:note, claim: claim_not_verified_has_duplicates_provider_email_manually_sent, label: "provider_verification")
create(:note, claim: claim_not_verified_provider_email_not_sent, label: "student_loan_plan")
create(:note, claim: claim_not_verified_has_duplicates_provider_email_not_sent_has_other_note, label: "student_loan_plan")
end

it "returns claims that have not been verified by the provider, and have had a provider email sent" do
is_expected.to match_array([claim_not_verified_provider_email_automatically_sent, claim_not_verified_has_duplicates_provider_email_manually_sent])
describe ".awaiting_further_education_provider_verification" do
subject { described_class.awaiting_further_education_provider_verification }

it "returns claims that have not been verified by the provider, and have had a provider email sent" do
is_expected.to match_array(
[
claim_not_verified_provider_email_automatically_sent,
claim_not_verified_has_duplicates_provider_email_manually_sent
]
)
end
end

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

it "returns claims that have no FE eligiblity, or FE claims that have been verified by the provider, or non-verified claims where a provider email has not been sent" do
is_expected.to match_array(
[
claim_not_verified_has_duplicates_provider_email_not_sent_has_other_note,
claim_not_verified_has_duplicates_provider_email_not_sent,
claim_with_fe_provider_verification,
non_fe_claim
]
)
end
end
end

Expand Down

0 comments on commit df596c3

Please sign in to comment.