-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Fix category is/is not (nothing) filters #3669
Fix category is/is not (nothing) filters #3669
Conversation
✅ 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
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
View detailed bundle breakdownAdded No assets were added Removed No assets were removed Bigger
Smaller No assets were smaller Unchanged No assets were unchanged |
WalkthroughThe pull request introduces several changes across multiple files to enhance the filtering capabilities of the application. In the Assessment against linked issues
Possibly related PRs
Suggested labels
Suggested reviewers
Warning There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure. 🔧 eslint
error Couldn't find any versions for "@typescript-eslint/types" that matches "8.15.0" 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
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
🧹 Outside diff range and nitpick comments (4)
packages/loot-core/src/shared/rules.ts (1)
72-73
: LGTM! Consider adding documentation for theparent
field.The addition of
transfer
andparent
fields toFIELD_INFO
is correct and aligns with the PR objectives. Both fields are properly typed asboolean
.The
transfer
field clearly supports the new filtering capability for transfer transactions. However, the purpose of theparent
field is not immediately clear from the PR objectives or surrounding context.Consider adding a comment to explain the purpose and usage of the
parent
field for better maintainability.packages/desktop-client/src/components/filters/FiltersMenu.jsx (1)
57-57
: LGTM! Consider enhancing readability with a comment.The addition of 'transfer' to the
filterFields
array is correct and aligns with the PR objectives. It enables filtering transactions based on whether they are transfers or not.Consider adding a brief comment above the
filterFields
array to explain its purpose and the significance of the order, if any. This would enhance code readability and maintainability. For example:// Define filter fields in order of appearance in the UI const filterFields = [ 'date', 'account', // ... other fields ... 'transfer', ].map(field => [field, mapField(field)]);packages/loot-core/src/server/aql/compiler.ts (1)
697-697
: Consider updating documentation and communicating this changeWhile this fix correctly implements the
$ne
operator for NULL comparisons, it's important to note that this change might affect existing queries that relied on the previous (incorrect) behavior. To ensure a smooth transition:
- Update any relevant documentation to reflect this change in NULL handling.
- Consider adding a note in the changelog or release notes about this behavior change.
- If possible, analyze existing queries in the system to identify any that might be affected by this change and plan for their updates.
This change aligns the behavior with SQL standards, which should improve consistency and reduce confusion for users familiar with SQL.
packages/loot-core/src/server/accounts/transaction-rules.ts (1)
344-360
: Consider adding comments to clarify condition remapping logicThe remapping of
field
,op
, andvalue
for'transfer'
and'parent'
conditions is functionally correct but may not be immediately intuitive. Adding explanatory comments could improve readability and help future maintainers understand the rationale behind these transformations.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
⛔ Files ignored due to path filters (1)
upcoming-release-notes/3669.md
is excluded by!**/*.md
📒 Files selected for processing (5)
- packages/desktop-client/src/components/filters/FiltersMenu.jsx (1 hunks)
- packages/loot-core/src/server/accounts/transaction-rules.ts (3 hunks)
- packages/loot-core/src/server/aql/compiler.ts (1 hunks)
- packages/loot-core/src/shared/rules.ts (1 hunks)
- packages/loot-core/src/types/models/rule.d.ts (1 hunks)
🧰 Additional context used
🔇 Additional comments (4)
packages/loot-core/src/types/models/rule.d.ts (1)
40-41
: LGTM! Please clarify the purpose of theparent
field.The addition of the
transfer
field aligns well with the PR objectives, specifically addressing Issue #904 by enabling filtering of transfer transactions. This change enhances the application's filtering capabilities as intended.The
parent
field, while a logical addition to theFieldValueTypes
, is not explicitly mentioned in the PR objectives or linked issues. Could you please provide some context on its purpose and how it relates to the overall enhancements being made?To ensure these changes are properly utilized, let's check for their usage in the codebase:
packages/loot-core/src/server/aql/compiler.ts (1)
697-697
: Excellent fix for the$ne
NULL comparison!This change correctly implements the
$ne
(not equal) operator when comparing with NULL. It now returnsIS NOT NULL
instead ofIS NULL
, which aligns with the SQL standard and fixes the logical error in the previous implementation. This adjustment ensures thatX != NULL
is correctly interpreted asX IS NOT NULL
, addressing the issue mentioned in the PR objectives.To ensure this change doesn't introduce any regressions, let's verify its usage:
packages/loot-core/src/server/accounts/transaction-rules.ts (2)
293-309
: Well-implemented handling of special cases inconditionSpecialCases
The new
conditionSpecialCases
function effectively manages special cases where thecategory
field isnull
. It correctly expands these conditions to include checks for'transfer'
and'parent'
, enhancing the accuracy of condition processing.
329-329
: Appropriate integration of special conditions using.flatMap
The addition of
.flatMap(conditionSpecialCases)
integrates the special case conditions seamlessly into the condition processing pipeline. This ensures that all expanded conditions are considered before filtering, improving the overall logic flow.
Sorry, been away and didn't notice the last change had a lint error. Fixed. |
/update-vrt |
3 similar comments
/update-vrt |
/update-vrt |
/update-vrt |
Sorry, it won't let me! Would you mind trying/making the change on your end and pushing please? |
Ok. I will have to tonight though. |
Of course! No problem, whenever you get a chance. |
Don't worry, I found a way to do it |
rename subExpression to and Co-authored-by: Koen van Staveren <[email protected]>
This reverts commit a450fc7.
47b3b38
to
5b5afa5
Compare
Fixes #901, Fixes #904
This fixes up the category filtering when no category is selected. Transfers and split parents both have no category, so when a filter of no category is selected, the other two filters will be added to make it complete. Since transfers have to be specified, this also add support for filtering by is it a transfer or not.
Lastly, it looked like, in the compiler.ts the case for
'$ne' NULL
seemed incorrect, making the SQLX IS NULL
just like the'$eq' NULL
path. I would have expected'$ne' NULL
to create theX IS NOT NULL
, which was required to fix in order to find transactions that are or are not transfers.