Fix #1369: Add accrued interest instead of subtracting it - #1580
Conversation
ogazboiz
left a comment
There was a problem hiding this comment.
the fix is correct and #1369 is real (loanController.ts:563 subtracts accrued interest). but #1575 contains this exact one-line change plus regression tests, so I'm merging that one and asking you to rebase: after #1575 lands this diff becomes empty. if you'd like to land something here, rebase and add extra coverage (e.g. a totalOwed test with nonzero accrued interest and partial repayment) or pick up another issue.
if you want to keep contributing, join us on Telegram: https://t.me/+DOylgFv1jyJlNzM0
|
following up on my earlier review: #1575 just merged with this exact controller change plus regression tests, so this diff is now empty. closing as superseded. the diagnosis was right, so please grab another issue, and thanks again. if you want to keep contributing, join us on Telegram: https://t.me/+DOylgFv1jyJlNzM0 |
Description: closes #1369.
The getLoanDetails function in backend/src/controllers/loanController.ts contained a logic defect where accrued interest was being incorrectly subtracted from the total owed amount, rather than being added to it.
This PR corrects the calculation logic from: const totalOwed = principal - accruedInterest - totalRepaid; to const totalOwed = principal + accruedInterest - totalRepaid;
This ensures borrowers must properly pay accrued interest to fully repay their loan.