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
@@ -128,6 +128,10 @@ async function calculateProgress(plan, assets, users, userId) {
const monthlyInvestment = (totalUserPlanValue - totalUserAssetValue + totalCostOfRetirement) / monthsUntilRetirement; const monthlyInvestment = (totalUserPlanValue - totalUserAssetValue + totalCostOfRetirement) / monthsUntilRetirement;
const percentageCalculated = (totalUserAssetValue / (totalUserPlanValue + totalCostOfRetirement)) * 100; const percentageCalculated = (totalUserAssetValue / (totalUserPlanValue + totalCostOfRetirement)) * 100;
if (monthsUntilRetirement <= 0) {
return { monthlyInvestment: 0, totalCostOfRetirement: totalCostOfRetirement, monthsUntilRetirement: 0, yearsRetired: yearsRetired, yearsUntilRetirement: 0, percentage: 0 };
}
const progress = {}; const progress = {};