This commit is contained in:
Mateusz Gruszczyński
2026-06-03 13:18:08 +02:00
parent 7cb2eddafe
commit 3a4e1b90e2
6 changed files with 107 additions and 19 deletions
+7 -2
View File
@@ -127,7 +127,8 @@ def _scheduled_overpayment_for_month(req: SimulationRequest, month: int) -> tupl
active = True
if active:
total += op.amount
fee += op.amount * op.commission_percent / 100
if op.commission_until_month is None or month <= op.commission_until_month:
fee += op.amount * op.commission_percent / 100
return total, fee
@@ -144,9 +145,13 @@ def _overpayment_for_month(req: SimulationRequest, month: int, historical: dict[
return scheduled_amount + hist_amount, scheduled_fee + hist_fee
def _term_months(req: SimulationRequest) -> int:
return int(req.term_months or req.years * 12)
def _simulate_raw(req: SimulationRequest, include_overpayments: bool = True) -> list[ScheduleRow]:
balance = float(req.principal)
total_months = int(req.years * 12)
total_months = _term_months(req)
rows: list[ScheduleRow] = []
fixed_payment: float | None = None
month = 1