From 715bc00e3bcca8a539bfb2327a1e120dc595941e Mon Sep 17 00:00:00 2001 From: joel-rich <6070705+joel-rich@users.noreply.github.com> Date: Sun, 20 Oct 2024 23:59:41 -0600 Subject: [PATCH] Fix incorrect cumulative totals for Days 28+ on the Spending Report (#3679) * Fix bug with spending report cumulative totals * release notes --------- Co-authored-by: Joel Rich --- .../components/reports/spreadsheets/spending-spreadsheet.ts | 2 +- upcoming-release-notes/3679.md | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 upcoming-release-notes/3679.md 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