From bfa2c4dbc176ff23bc4f8f7044df3ff75a9a02d2 Mon Sep 17 00:00:00 2001 From: zzhhaa Date: Wed, 27 Nov 2024 16:25:48 +0100 Subject: [PATCH] docs: clearer mortgage if-then comment --- app/models/Lifetime.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/models/Lifetime.ts b/app/models/Lifetime.ts index 523050f..23fada0 100644 --- a/app/models/Lifetime.ts +++ b/app/models/Lifetime.ts @@ -116,11 +116,13 @@ export class Lifetime { maintenanceCostIterative = newBuildPriceIterative * params.maintenancePercentage; + // If the mortgage term ongoing (if `i` is less than the term), calculate yearly mortgage payments if (i < params.marketPurchase.houseMortgage.termYears - 1) { newbuildHouseMortgageYearlyIterative = params.marketPurchase.houseMortgage.yearlyPaymentBreakdown[i].yearlyPayment; depreciatedHouseMortgageYearlyIterative = params.fairholdLandPurchase.depreciatedHouseMortgage.yearlyPaymentBreakdown[i].yearlyPayment; fairholdLandMortgageYearlyIterative = params.fairholdLandPurchase.discountedLandMortgage.yearlyPaymentBreakdown[i].yearlyPayment marketLandMortgageYearlyIterative = params.marketPurchase.landMortgage.yearlyPaymentBreakdown[i].yearlyPayment; + // If the mortgage term has ended, yearly payment is 0 } else { newbuildHouseMortgageYearlyIterative = 0; depreciatedHouseMortgageYearlyIterative = 0;