fix/calculations capped if you try to retire today

This commit is contained in:
nicoagostini committed 2025-05-22 11:09:15 -07:00
1 parent 8998283552
commit 16f267bcd4
1 file changed
+4
+4
View File
@@ -129,6 +129,10 @@ async function calculateProgress(plan, assets, users, userId) {
const percentageCalculated = (totalUserAssetValue / (totalUserPlanValue + totalCostOfRetirement)) * 100;
if (monthsUntilRetirement <= 0) {
return { monthlyInvestment: 0, totalCostOfRetirement: totalCostOfRetirement, monthsUntilRetirement: 0, yearsRetired: yearsRetired, yearsUntilRetirement: 0, percentage: 0 };
}
const progress = {};
progress.monthlyInvestment = Math.round(monthlyInvestment);