1
0
mirror of https://gitlab.com/MisterBiggs/secure-act-2.0.git synced 2025-08-18 00:34:43 +00:00

Fix calculation inconsistencies and chart data cutoff

- Fix chart data showing age 70 values instead of age 65 retirement values
- Update all hardcoded examples to match actual calculator output
- Recent Graduate: 75K → 94K (corrected retirement value)
- MBA Graduate: 25K → 29K (corrected retirement value)
- Medical Professional: 85K → ,065K (corrected)
- Teacher: 8K → 88K (corrected)
- Software Engineer: 12K → ,132K (corrected)
- Attorney: 5K → 54K (corrected)
- All examples now mathematically consistent with calculator logic
- Charts no longer appear to 'slow down' at retirement age
This commit is contained in:
2025-08-13 12:13:04 -06:00
parent bc62f616ab
commit 8880b729d7
2 changed files with 19 additions and 14 deletions

View File

@@ -159,15 +159,20 @@ function calculateNetWorthComparison(params) {
}
}
// Find age 65 index for retirement values
const age65Index = allAges.findIndex(age => age === RETIREMENT_AGE);
const retirementWith = age65Index >= 0 ? allWithProgram[age65Index] : allWithProgram[allWithProgram.length - 1];
const retirementWithout = age65Index >= 0 ? allWithoutProgram[age65Index] : allWithoutProgram[allWithoutProgram.length - 1];
return {
ages,
withProgram,
withoutProgram,
payoffYears,
annualMatch,
totalRetirementWith: allWithProgram[allWithProgram.length - 1],
totalRetirementWithout: allWithoutProgram[allWithoutProgram.length - 1],
retirementDifference: allWithProgram[allWithProgram.length - 1] - allWithoutProgram[allWithoutProgram.length - 1],
totalRetirementWith: retirementWith,
totalRetirementWithout: retirementWithout,
retirementDifference: retirementWith - retirementWithout,
// Include full yearly data if needed
allAges,
allWithProgram,