Fix Net Worth Calculations (#6968)

* fix: computed priorPeriodNetWorth and use it as a baseline for net worth calculations

* add release notes

* correct spelling

* Update VRT screenshots

Auto-generated by VRT workflow

PR: #6968

* Update VRT screenshots

Auto-generated by VRT workflow

PR: #6968

* Update VRT screenshots

Auto-generated by VRT workflow

PR: #6968

* Update VRT screenshots

Auto-generated by VRT workflow

PR: #6968

* Update VRT screenshots

Auto-generated by VRT workflow

PR: #6968

* note

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: youngcw <calebyoung94@gmail.com>
This commit is contained in:
Pratik Silwal
2026-02-19 11:06:21 -06:00
committed by GitHub
parent 848b86cd59
commit ce890faeeb
8 changed files with 13 additions and 6 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 103 KiB

After

Width:  |  Height:  |  Size: 105 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 103 KiB

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 104 KiB

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 KiB

After

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 89 KiB

After

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 93 KiB

After

Width:  |  Height:  |  Size: 94 KiB

View File

@@ -187,8 +187,12 @@ function recalculate(
});
});
const priorPeriodNetWorth = data.reduce(
(sum, account) => sum + account.starting,
0,
);
let hasNegative = false;
let startNetWorth = 0;
let endNetWorth = 0;
let lowestNetWorth: number | null = null;
let highestNetWorth: number | null = null;
@@ -236,11 +240,8 @@ function recalculate(
x = d.parseISO(intervalItem + '-01');
}
const change = last ? total - last.y : 0;
const change = last ? total - last.y : total - priorPeriodNetWorth;
if (arr.length === 0) {
startNetWorth = total;
}
endNetWorth = total;
// Use standardized format from ReportOptions
@@ -292,7 +293,7 @@ function recalculate(
end: endDate,
},
netWorth: endNetWorth,
totalChange: endNetWorth - startNetWorth,
totalChange: endNetWorth - priorPeriodNetWorth,
lowestNetWorth,
highestNetWorth,
accounts: data

View File

@@ -0,0 +1,6 @@
---
category: Bugfixes
authors: [PratikSilwal5]
---
Correctly calculate the net worth change value on the first month of the report.