Skip to content

Commit

Permalink
back office can filter for auto approved claims
Browse files Browse the repository at this point in the history
  • Loading branch information
asmega committed Oct 10, 2024
1 parent 8ebe7d9 commit f732e2a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/forms/admin/claims_filter_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"]
Expand Down
4 changes: 4 additions & 0 deletions spec/factories/claims.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
16 changes: 16 additions & 0 deletions spec/forms/admin/claims_filter_form_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit f732e2a

Please sign in to comment.