mirror of
https://github.com/actualbudget/actual.git
synced 2026-05-10 16:26:43 -05:00
🐛 fix category is nothing rule crashing spending report widget (#4360)
This commit is contained in:
committed by
GitHub
parent
8351edc8bb
commit
524707cecc
@@ -52,6 +52,7 @@ export function createSpendingSpreadsheet({
|
||||
conditions: conditions.filter(
|
||||
cond => !cond.customName && cond.field === 'category',
|
||||
),
|
||||
applySpecialCases: false,
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
@@ -337,7 +337,10 @@ function conditionSpecialCases(cond: Condition | null): Condition | null {
|
||||
}
|
||||
|
||||
// This does the inverse: finds all the transactions matching a rule
|
||||
export function conditionsToAQL(conditions, { recurDateBounds = 100 } = {}) {
|
||||
export function conditionsToAQL(
|
||||
conditions,
|
||||
{ recurDateBounds = 100, applySpecialCases = true } = {},
|
||||
) {
|
||||
const errors = [];
|
||||
|
||||
conditions = conditions
|
||||
@@ -354,7 +357,7 @@ export function conditionsToAQL(conditions, { recurDateBounds = 100 } = {}) {
|
||||
return null;
|
||||
}
|
||||
})
|
||||
.map(conditionSpecialCases)
|
||||
.map(cond => (applySpecialCases ? conditionSpecialCases(cond) : cond))
|
||||
.filter(Boolean);
|
||||
|
||||
// rule -> actualql
|
||||
|
||||
@@ -515,8 +515,11 @@ handlers['payees-get-rules'] = async function ({ id }) {
|
||||
return rules.getRulesForPayee(id).map(rule => rule.serialize());
|
||||
};
|
||||
|
||||
handlers['make-filters-from-conditions'] = async function ({ conditions }) {
|
||||
return rules.conditionsToAQL(conditions);
|
||||
handlers['make-filters-from-conditions'] = async function ({
|
||||
conditions,
|
||||
applySpecialCases,
|
||||
}) {
|
||||
return rules.conditionsToAQL(conditions, { applySpecialCases });
|
||||
};
|
||||
|
||||
handlers['getCell'] = async function ({ sheetName, name }) {
|
||||
|
||||
@@ -127,6 +127,7 @@ export interface ServerHandlers {
|
||||
|
||||
'make-filters-from-conditions': (arg: {
|
||||
conditions: unknown;
|
||||
applySpecialCases?: boolean;
|
||||
}) => Promise<{ filters: unknown[] }>;
|
||||
|
||||
getCell: (arg: {
|
||||
|
||||
6
upcoming-release-notes/4360.md
Normal file
6
upcoming-release-notes/4360.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
category: Bugfix
|
||||
authors: [MatissJanis]
|
||||
---
|
||||
|
||||
Fix "category is (nothing)" filter crashing the spending analysis report widget.
|
||||
Reference in New Issue
Block a user