Skip to content

A local-first personal finance app

Fix incorrect cumulative totals for Days 28+ on the Spending Report (#3679)

joel-rich715bc00e3bcc
diff --git a/packages/desktop-client/src/components/reports/spreadsheets/spending-spreadsheet.ts b/packages/desktop-client/src/components/reports/spreadsheets/spending-spreadsheet.ts
index 70619281fd..851b4751ef 100644
--- a/packages/desktop-client/src/components/reports/spreadsheets/spending-spreadsheet.ts
+++ b/packages/desktop-client/src/components/reports/spreadsheets/spending-spreadsheet.ts
@@ -223,7 +223,7 @@ export function createSpendingSpreadsheet({
return arr;
}, []);
const maxCumulative = data.reduce((a, b) =>
- a.cumulative < b.cumulative ? a : b,
+ b.cumulative === null ? a : b,
).cumulative;
const totalDaily = data.reduce((a, v) => (a = a + v.totalTotals), 0);
diff --git a/upcoming-release-notes/3679.md b/upcoming-release-notes/3679.md
new file mode 100644
index 0000000000..e19e4be6db
--- /dev/null
+++ b/upcoming-release-notes/3679.md
@@ -0,0 +1,6 @@
+---
+category: Bugfix
+authors: [joel-rich]
+---
+
+Fix incorrect cumulative totals for Days 28+ on the Spending Report