Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CAPT-1402] Back office can filter for auto approved claims #3292

Merged
merged 1 commit into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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