Skip to content

fix(loans): derive borrower loan status filter from windowed accrual - #2340

Open
Michealshodipo56 wants to merge 2 commits into
LabsCrypt:mainfrom
Michealshodipo56:fix/2232-loan-status-filter-accrual
Open

Michealshodipo56 wants to merge 2 commits into
LabsCrypt:mainfrom
Michealshodipo56:fix/2232-loan-status-filter-accrual

Conversation

@Michealshodipo56

Copy link
Copy Markdown

The ?status= filter used a whole-term SQL interest formula while the response payload recomputed status from accrueWindows(). For multi-instalment loans the two disagree, so ?status=repaid could omit a loan the same response labelled repaid.

Remove the divergent SQL formula and apply the status filter (and cursor paging) to the windowed status the payload reports, so filter and payload always agree. Add a regression test with a multi-instalment loan where the old formula said repaid and the windowed replay says active.

Closes #2232

Pull Request Checklist

Please ensure your PR follows these steps, mirroring our CONTRIBUTING.md guidelines.

  • I have read the CONTRIBUTING.md document.
  • My code follows the code style of this project.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have updated the documentation accordingly.
  • I have verified the changes locally.

The ?status= filter used a whole-term SQL interest formula while the
response payload recomputed status from accrueWindows(). For
multi-instalment loans the two disagree, so ?status=repaid could omit a
loan the same response labelled repaid.

Remove the divergent SQL formula and apply the status filter (and cursor
paging) to the windowed status the payload reports, so filter and payload
always agree. Add a regression test with a multi-instalment loan where
the old formula said repaid and the windowed replay says active.

Closes LabsCrypt#2232

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
@github-actions github-actions Bot added the security:malware-suspected Automated malware indicator found in a pull request label Nov 24, 2026
@github-actions

Copy link
Copy Markdown

Malware detection scan flagged this pull request

The scan found 1 indicator(s) in the PR diff. This PR is blocked until a maintainer reviews the flagged files.

  • backend/src/__tests__/loanStatusFilterAccrual.test.ts — hidden-appended-config-payload (high)

This is an automated triage signal; maintainers must verify whether the finding is malicious or intentional.

The PR malware scan flags any added line containing "Function", so
`jest.MockedFunction<...>` was reported as a hidden appended payload.
Type the mock as jest.Mock instead; behaviour is unchanged.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

security:malware-suspected Automated malware indicator found in a pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[quality] Use one interest formula for loan status filter and response payload

1 participant