From df596c36d5ab2370fdbe1968a1a738c885bda2df Mon Sep 17 00:00:00 2001 From: Alkesh Vaghmaria Date: Fri, 27 Sep 2024 12:42:43 +0100 Subject: [PATCH] Change filter "Awaiting decision - not on hold" to not include claims awaiting provider verification --- app/forms/admin/claims_filter_form.rb | 2 +- app/models/claim.rb | 3 ++ .../admin/admin_claims_filtering_spec.rb | 4 ++- ...w_claim_further_education_payments_spec.rb | 16 ++++++--- spec/models/claim_spec.rb | 36 +++++++++++++++---- 5 files changed, 48 insertions(+), 13 deletions(-) diff --git a/app/forms/admin/claims_filter_form.rb b/app/forms/admin/claims_filter_form.rb index 1bc54e89d5..524874e267 100644 --- a/app/forms/admin/claims_filter_form.rb +++ b/app/forms/admin/claims_filter_form.rb @@ -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 diff --git a/app/models/claim.rb b/app/models/claim.rb index 38904495c9..2adf2ab108 100644 --- a/app/models/claim.rb +++ b/app/models/claim.rb @@ -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}" diff --git a/spec/features/admin/admin_claims_filtering_spec.rb b/spec/features/admin/admin_claims_filtering_spec.rb index b69cbf0aef..ed8f702fa3 100644 --- a/spec/features/admin/admin_claims_filtering_spec.rb +++ b/spec/features/admin/admin_claims_filtering_spec.rb @@ -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 @@ -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 @@ -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:" diff --git a/spec/features/admin/admin_view_claim_further_education_payments_spec.rb b/spec/features/admin/admin_view_claim_further_education_payments_spec.rb index ebdd989e7b..469615e50f 100644 --- a/spec/features/admin/admin_view_claim_further_education_payments_spec.rb +++ b/spec/features/admin/admin_view_claim_further_education_payments_spec.rb @@ -8,7 +8,7 @@ :claim, :submitted, policy: Policies::FurtherEducationPayments, - eligibility_trait: :not_verified + eligibility_trait: :duplicate ) } let!(:claim_with_trn) { @@ -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, @@ -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") diff --git a/spec/models/claim_spec.rb b/spec/models/claim_spec.rb index 235ccdff5e..a6962a42ff 100644 --- a/spec/models/claim_spec.rb +++ b/spec/models/claim_spec.rb @@ -906,11 +906,9 @@ 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) } @@ -918,11 +916,35 @@ 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