Remove dead code and fix off-by-one in current_balance_estimate #16

Open
opened 2026-06-06 19:58:12 +00:00 by tonym · 0 comments

Severity: high
Category: bug
Location: mortgage.py:111-124

Problem

Lines 111-114 are an if False: dead loop. The lookup schedule[months_elapsed] returns the balance AFTER the first payment at month 0, so the estimate is always one period low.

Suggested fix

Delete the dead loop; index schedule[max(months_elapsed-1, 0)]['balance'].

Filed by automated code review.

**Severity:** high **Category:** bug **Location:** `mortgage.py:111-124` ### Problem Lines 111-114 are an `if False:` dead loop. The lookup `schedule[months_elapsed]` returns the balance AFTER the first payment at month 0, so the estimate is always one period low. ### Suggested fix Delete the dead loop; index `schedule[max(months_elapsed-1, 0)]['balance']`. _Filed by automated code review._
tonym added the
bug
severity:high
labels 2026-06-06 19:58:12 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: bonna61/Moon-Household-Budget#16
No description provided.