1
0
mirror of https://gitlab.com/MisterBiggs/secure-act-2.0.git synced 2025-08-17 16:24: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,

View File

@@ -180,9 +180,9 @@
<p><strong>Employer Match:</strong> 4%</p>
</div>
<div class="mt-4 p-3 bg-white rounded">
<p class="text-lg font-bold text-blue-600">$275,117</p>
<p class="text-lg font-bold text-blue-600">$493,553</p>
<p class="text-xs text-gray-600">Retirement value at age 65</p>
<p class="text-xs text-blue-600 mt-1">$22,000 in matching over 11 years</p>
<p class="text-xs text-blue-600 mt-1">$20,000 in matching over 10 years</p>
</div>
</div>
@@ -202,9 +202,9 @@
<p><strong>Employer Match:</strong> 5%</p>
</div>
<div class="mt-4 p-3 bg-white rounded">
<p class="text-lg font-bold text-green-600">$424,608</p>
<p class="text-lg font-bold text-green-600">$729,134</p>
<p class="text-xs text-gray-600">Retirement value at age 65</p>
<p class="text-xs text-green-600 mt-1">$59,500 in matching over 14 years</p>
<p class="text-xs text-green-600 mt-1">$46,750 in matching over 11 years</p>
</div>
</div>
@@ -224,9 +224,9 @@
<p><strong>Employer Match:</strong> 6%</p>
</div>
<div class="mt-4 p-3 bg-white rounded">
<p class="text-lg font-bold text-purple-600">$285,000</p>
<p class="text-lg font-bold text-purple-600">$1,064,977</p>
<p class="text-xs text-gray-600">Retirement value at age 65</p>
<p class="text-xs text-purple-600 mt-1">$122,400 in matching over 17 years</p>
<p class="text-xs text-purple-600 mt-1">$93,600 in matching over 13 years</p>
</div>
</div>
</div>
@@ -249,9 +249,9 @@
<p><strong>Employer Match:</strong> 3%</p>
</div>
<div class="mt-4 p-3 bg-white rounded">
<p class="text-lg font-bold text-amber-600">$58,000</p>
<p class="text-lg font-bold text-amber-600">$288,373</p>
<p class="text-xs text-gray-600">Retirement value at age 65</p>
<p class="text-xs text-amber-600 mt-1">$28,350 in matching over 21 years</p>
<p class="text-xs text-amber-600 mt-1">$18,900 in matching over 14 years</p>
</div>
</div>
@@ -271,7 +271,7 @@
<p><strong>Employer Match:</strong> 6%</p>
</div>
<div class="mt-4 p-3 bg-white rounded">
<p class="text-lg font-bold text-indigo-600">$112,000</p>
<p class="text-lg font-bold text-indigo-600">$1,132,220</p>
<p class="text-xs text-gray-600">Retirement value at age 65</p>
<p class="text-xs text-indigo-600 mt-1">$34,200 in matching over 6 years</p>
</div>
@@ -293,9 +293,9 @@
<p><strong>Employer Match:</strong> 4%</p>
</div>
<div class="mt-4 p-3 bg-white rounded">
<p class="text-lg font-bold text-red-600">$95,000</p>
<p class="text-lg font-bold text-red-600">$553,921</p>
<p class="text-xs text-gray-600">Retirement value at age 65</p>
<p class="text-xs text-red-600 mt-1">$69,000 in matching over 23 years</p>
<p class="text-xs text-red-600 mt-1">$45,000 in matching over 15 years</p>
</div>
</div>
</div>