-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Spending Report: Fix budget category filtering #4194
base: master
Are you sure you want to change the base?
Spending Report: Fix budget category filtering #4194
Conversation
- Previously only worked for category *is*, now should work for any category filters
✅ Deploy Preview for actualbudget ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Bundle Stats — desktop-clientHey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle. As this PR is updated, I'll keep you updated on how the bundle size is impacted. Total
Changeset
View detailed bundle breakdownAdded No assets were added Removed No assets were removed Bigger
Smaller No assets were smaller Unchanged
|
Bundle Stats — loot-coreHey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle. As this PR is updated, I'll keep you updated on how the bundle size is impacted. Total
Changeset No files were changed View detailed bundle breakdownAdded No assets were added Removed No assets were removed Bigger No assets were bigger Smaller No assets were smaller Unchanged
|
…r options - Removed ability to select 'contains', 'doesNotContain', or 'matches' filters for budget categories
WalkthroughThe pull request modifies the Assessment against linked issues
Possibly related PRs
Suggested labels
Suggested reviewers
Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
packages/desktop-client/src/components/reports/spreadsheets/spending-spreadsheet.ts (2)
49-59
: LGTM! Consider adding type annotations for better type safety.The implementation correctly handles budget category filtering by excluding incompatible operations ('contains', 'doesNotContain', 'matches') and restricting to category fields, which aligns with the PR objectives.
Consider adding type annotations for the destructured
filters
object:- const { filters: budgetFilters } = await send( + const { filters: budgetFilters }: { filters: typeof filters } = await send(
Line range hint
48-125
: Well-structured implementation with good separation of concerns.The architectural approach of separating budget-specific filters from general filters is clean and maintainable. This separation:
- Allows for different filter operations between budgets and transactions
- Makes it easier to add support for additional filter types in the future
- Maintains clear boundaries between different filtering concerns
The implementation aligns well with the existing patterns in the codebase.
Consider documenting these architectural decisions in the codebase to help future maintainers understand the reasoning behind the separate filtering mechanisms.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
upcoming-release-notes/4194.md
is excluded by!**/*.md
📒 Files selected for processing (1)
packages/desktop-client/src/components/reports/spreadsheets/spending-spreadsheet.ts
(2 hunks)
🧰 Additional context used
📓 Learnings (1)
packages/desktop-client/src/components/reports/spreadsheets/spending-spreadsheet.ts (1)
Learnt from: jfdoming
PR: actualbudget/actual#4146
File: packages/desktop-client/src/components/reports/spreadsheets/summary-spreadsheet.ts:30-30
Timestamp: 2025-01-14T06:17:55.345Z
Learning: The `make-filters-from-conditions` function in the Actual Budget codebase returns a complex type that is not explicitly defined. While improving its type definition would be beneficial, it should be handled in a dedicated project due to its complexity.
🔇 Additional comments (1)
packages/desktop-client/src/components/reports/spreadsheets/spending-spreadsheet.ts (1)
125-125
: LGTM! Verify query behavior with different filter combinations.The implementation correctly applies the budget-specific filters to the zero_budgets query while maintaining consistency with the existing query structure.
Let's verify the query behavior with different filter combinations:
✅ Verification successful
Implementation verified - follows established query patterns
The budget filter implementation follows the same query structure used consistently across all report types in the codebase, integrating correctly with the core query system in
makeQuery.ts
. The pattern of usingconditionsOp
with filters is well-established and verified in multiple spreadsheet implementations.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Search for tests covering different budget filter combinations # Look for test files related to spending reports fd -e test.ts -e test.tsx -e spec.ts -e spec.tsx . | grep -i "spend" # Search for budget filter test cases rg -l "zero_budgets.*filter" # Look for filter condition combinations in test files rg "conditions.*category.*(?:oneOf|not in|is)" -A 5Length of output: 153
Script:
#!/bin/bash # Search for the specific file and related test files fd "spending-spreadsheet" . # Look for similar query patterns in the codebase rg -l "conditionsOp.*filters" . # Search for budget-related query implementations ast-grep --pattern 'budgetFilters = $_' # Look for test files with query conditions rg -l "conditions.*filters?" packages/Length of output: 5420
Fixes up the Spending Report category filters when comparing to the budget. Previously only worked for the category is filter. Now added support for other category filters (one of, not in, etc.)
Note that this does not fix the filters for
contains
,matches
, ordoes not contain
since they seem to create incompatible joins on the zero_budgets table so I'm simply filtering these options out for now.Fixes #4044