From 5362b3a8929ec0b1f7f62b73a073dbf41d5f7c0f Mon Sep 17 00:00:00 2001 From: Phil Lee Date: Thu, 10 Oct 2024 13:06:30 +0100 Subject: [PATCH 1/3] status of rejected trumps provider verification --- app/helpers/admin/claims_helper.rb | 6 +++--- spec/factories/claims.rb | 8 ++++++++ spec/helpers/admin/claims_helper_spec.rb | 17 +++++++++++++++++ 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/app/helpers/admin/claims_helper.rb b/app/helpers/admin/claims_helper.rb index 49e98b2c2b..1142a130e3 100644 --- a/app/helpers/admin/claims_helper.rb +++ b/app/helpers/admin/claims_helper.rb @@ -172,9 +172,7 @@ def claim_summary_heading(claim) end def status(claim) - if claim.awaiting_provider_verification? - "Awaiting provider verification" - elsif claim.all_payrolled? + if claim.all_payrolled? "Payrolled" elsif claim.latest_decision&.approved? && claim.awaiting_qa? && !claim.held? "Approved awaiting QA" @@ -182,6 +180,8 @@ def status(claim) "Approved awaiting payroll" elsif claim.latest_decision&.rejected? "Rejected" + elsif claim.awaiting_provider_verification? + "Awaiting provider verification" elsif claim.held? "Awaiting decision - on hold" else diff --git a/spec/factories/claims.rb b/spec/factories/claims.rb index cc17bae42a..0680f2c5bb 100644 --- a/spec/factories/claims.rb +++ b/spec/factories/claims.rb @@ -309,6 +309,14 @@ end end + trait :awaiting_provider_verification do + eligibility_trait { :not_verified } + + after(:create) do |claim, _| + create(:note, claim:, label: "provider_verification") + end + end + trait :with_dqt_teacher_status do dqt_teacher_status do { diff --git a/spec/helpers/admin/claims_helper_spec.rb b/spec/helpers/admin/claims_helper_spec.rb index 43f7303c1c..a3978e08ad 100644 --- a/spec/helpers/admin/claims_helper_spec.rb +++ b/spec/helpers/admin/claims_helper_spec.rb @@ -540,6 +540,23 @@ end end end + + context "rejected claim whilst awaiting provider verification" do + let!(:claim) do + create( + :claim, + :rejected, + :awaiting_provider_verification, + policy: Policies::FurtherEducationPayments, + ) + end + + it "returns rejected" do + freeze_time do + expect(status(claim)).to eql "Rejected" + end + end + end end describe "#index_status_filter" do From d594d82fe2f659f6734c06b5d2e3e0b8c3f88d9d Mon Sep 17 00:00:00 2001 From: Phil Lee Date: Thu, 10 Oct 2024 13:29:15 +0100 Subject: [PATCH 2/3] filtering awaiting_provider_verification - must now also be awaiting a decision - this prevents approved and rejected claims when filtering for this --- app/forms/admin/claims_filter_form.rb | 2 +- spec/forms/admin/claims_filter_form_spec.rb | 25 +++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 spec/forms/admin/claims_filter_form_spec.rb diff --git a/app/forms/admin/claims_filter_form.rb b/app/forms/admin/claims_filter_form.rb index 9e37bb314e..01c7bf0220 100644 --- a/app/forms/admin/claims_filter_form.rb +++ b/app/forms/admin/claims_filter_form.rb @@ -57,7 +57,7 @@ def claims when "failed_bank_validation" Claim.includes(:decisions).failed_bank_validation.awaiting_decision when "awaiting_provider_verification" - Claim.by_policy(Policies::FurtherEducationPayments).awaiting_further_education_provider_verification + Claim.by_policy(Policies::FurtherEducationPayments).awaiting_further_education_provider_verification.awaiting_decision else Claim.includes(:decisions).not_held.awaiting_decision.not_awaiting_further_education_provider_verification end diff --git a/spec/forms/admin/claims_filter_form_spec.rb b/spec/forms/admin/claims_filter_form_spec.rb new file mode 100644 index 0000000000..a842414b2f --- /dev/null +++ b/spec/forms/admin/claims_filter_form_spec.rb @@ -0,0 +1,25 @@ +require "rails_helper" + +RSpec.describe Admin::ClaimsFilterForm, type: :model do + describe "#claims" do + context "when rejected whilst awaiting provider verification" do + let!(:claim) do + create( + :claim, + :rejected, + :awaiting_provider_verification, + policy: Policies::FurtherEducationPayments, + ) + end + + let(:session) { {} } + let(:filters) { { status: "awaiting_provider_verification" } } + + subject { described_class.new(filters:, session:) } + + it "filtering by status awaiting provider verification excludes them" do + expect(subject.claims).not_to include(claim) + end + end + end +end From 3f14648f650122424c77386b35cdac62d8551dfd Mon Sep 17 00:00:00 2001 From: Phil Lee Date: Thu, 10 Oct 2024 13:47:57 +0100 Subject: [PATCH 3/3] fix linting --- spec/forms/admin/claims_filter_form_spec.rb | 4 ++-- spec/helpers/admin/claims_helper_spec.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/forms/admin/claims_filter_form_spec.rb b/spec/forms/admin/claims_filter_form_spec.rb index a842414b2f..57e7ac4b2f 100644 --- a/spec/forms/admin/claims_filter_form_spec.rb +++ b/spec/forms/admin/claims_filter_form_spec.rb @@ -8,12 +8,12 @@ :claim, :rejected, :awaiting_provider_verification, - policy: Policies::FurtherEducationPayments, + policy: Policies::FurtherEducationPayments ) end let(:session) { {} } - let(:filters) { { status: "awaiting_provider_verification" } } + let(:filters) { {status: "awaiting_provider_verification"} } subject { described_class.new(filters:, session:) } diff --git a/spec/helpers/admin/claims_helper_spec.rb b/spec/helpers/admin/claims_helper_spec.rb index a3978e08ad..a37a92d689 100644 --- a/spec/helpers/admin/claims_helper_spec.rb +++ b/spec/helpers/admin/claims_helper_spec.rb @@ -547,7 +547,7 @@ :claim, :rejected, :awaiting_provider_verification, - policy: Policies::FurtherEducationPayments, + policy: Policies::FurtherEducationPayments ) end