A local-first personal finance app
Spending Report: Fix budget category filtering (#4194)
Kate39361e5b62eb
diff --git a/packages/desktop-client/src/components/reports/spreadsheets/spending-spreadsheet.ts b/packages/desktop-client/src/components/reports/spreadsheets/spending-spreadsheet.tsindex 6159a2bbf4..6b7fab2cb3 100644--- a/packages/desktop-client/src/components/reports/spreadsheets/spending-spreadsheet.ts+++ b/packages/desktop-client/src/components/reports/spreadsheets/spending-spreadsheet.ts@@ -45,6 +45,16 @@ export function createSpendingSpreadsheet({const { filters } = await send('make-filters-from-conditions', {conditions: conditions.filter(cond => !cond.customName),});++ const { filters: budgetFilters } = await send(+ 'make-filters-from-conditions',+ {+ conditions: conditions.filter(+ cond => !cond.customName && cond.field === 'category',+ ),+ },+ );+const conditionsOpKey = conditionsOp === 'or' ? '$or' : '$and';const [assets, debts] = await Promise.all([@@ -109,7 +119,7 @@ export function createSpendingSpreadsheet({$and: [{ month: { $eq: budgetMonth } }],}).filter({- [conditionsOpKey]: filters.filter(filter => filter['category']),+ [conditionsOpKey]: budgetFilters,}).groupBy([{ $id: '$category' }]).select([diff --git a/packages/loot-core/src/server/aql/schema/index.ts b/packages/loot-core/src/server/aql/schema/index.tsindex f5e6dc47aa..df445ab01b 100644--- a/packages/loot-core/src/server/aql/schema/index.ts+++ b/packages/loot-core/src/server/aql/schema/index.ts@@ -169,7 +169,7 @@ export const schema = {zero_budgets: {id: f('id'),month: f('integer'),- category: f('string'),+ category: f('string', { ref: 'categories' }),amount: f('integer'),carryover: f('integer'),goal: f('integer'),diff --git a/upcoming-release-notes/4194.md b/upcoming-release-notes/4194.mdnew file mode 100644index 0000000000..b8a0ac5575--- /dev/null+++ b/upcoming-release-notes/4194.md@@ -0,0 +1,6 @@+---+category: Bugfix+authors: [CertifiKate]+---++Fix Spending Report category filters when comparing to Budgeted\ No newline at end of file