Skip to content

Fix #1369: Add accrued interest instead of subtracting it - #1580

Closed
T-kesh wants to merge 1 commit into
LabsCrypt:mainfrom
T-kesh:fix-issue-1369
Closed

Fix #1369: Add accrued interest instead of subtracting it#1580
T-kesh wants to merge 1 commit into
LabsCrypt:mainfrom
T-kesh:fix-issue-1369

Conversation

@T-kesh

@T-kesh T-kesh commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

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.

@ogazboiz ogazboiz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@ogazboiz

ogazboiz commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

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

@ogazboiz ogazboiz closed this Aug 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Backend] Owed amount ignores accrued interest

2 participants