diff --git a/app/forms/admin/claims_filter_form.rb b/app/forms/admin/claims_filter_form.rb index c80a57b1fe..0b4ac548c6 100644 --- a/app/forms/admin/claims_filter_form.rb +++ b/app/forms/admin/claims_filter_form.rb @@ -48,6 +48,8 @@ def claims Claim.approved.awaiting_qa when "approved_awaiting_payroll" approved_awaiting_payroll + when "automatically_approved" + Claim.current_academic_year.auto_approved when "automatically_approved_awaiting_payroll" Claim.current_academic_year.payrollable.auto_approved when "rejected" @@ -94,6 +96,7 @@ def status_select_options ["Awaiting decision - failed bank details", "failed_bank_validation"], ["Approved awaiting QA", "approved_awaiting_qa"], ["Approved awaiting payroll", "approved_awaiting_payroll"], + ["Automatically approved", "automatically_approved"], ["Automatically approved awaiting payroll", "automatically_approved_awaiting_payroll"], ["Approved", "approved"], ["Rejected", "rejected"] diff --git a/spec/factories/claims.rb b/spec/factories/claims.rb index 0680f2c5bb..f83470ca17 100644 --- a/spec/factories/claims.rb +++ b/spec/factories/claims.rb @@ -41,6 +41,10 @@ claim.academic_year = claim_academic_year unless claim.academic_year_before_type_cast end + trait :current_academic_year do + academic_year { AcademicYear.current } + end + trait :with_onelogin_idv_data do identity_confirmed_with_onelogin { true } onelogin_uid { SecureRandom.uuid } diff --git a/spec/forms/admin/claims_filter_form_spec.rb b/spec/forms/admin/claims_filter_form_spec.rb index 5364b7f2b2..8edf7a8473 100644 --- a/spec/forms/admin/claims_filter_form_spec.rb +++ b/spec/forms/admin/claims_filter_form_spec.rb @@ -80,5 +80,21 @@ ) end end + + context "filtering for unassigned + auto approved claims" do + subject { described_class.new(session:, filters: {team_member:, status:}) } + + let(:team_member) { "unassigned" } + let(:status) { "automatically_approved" } + let(:session) { {} } + + before do + create(:claim, :submitted, :auto_approved, :current_academic_year) + end + + it "works" do + expect(subject.claims.count).to eql(1) + end + end end end