-
Notifications
You must be signed in to change notification settings - Fork 671
fix(feature/loan): display Overpaid status for overpaid loan accounts #2593
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: development
Are you sure you want to change the base?
fix(feature/loan): display Overpaid status for overpaid loan accounts #2593
Conversation
📝 WalkthroughWalkthroughAdded a new public string resource Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Updates loan status rendering in the Loan Account Summary so overpaid loan accounts display an Overpaid label (instead of being treated like closed), aligning Mobile App behavior with the Web App.
Changes:
- Add explicit
status.overpaid == truehandling ingetButtonText(...). - Add a new localized string resource for the overpaid label.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
feature/loan/src/commonMain/kotlin/com/mifos/feature/loan/loanAccountSummary/LoanAccountSummaryScreen.kt |
Adds an overpaid branch in button/status text selection for loan summary UI. |
feature/loan/src/commonMain/composeResources/values/strings.xml |
Introduces a new string resource used to render the overpaid label. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
feature/loan/src/commonMain/composeResources/values/strings.xml
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
feature/loan/src/commonMain/kotlin/com/mifos/feature/loan/loanAccountSummary/LoanAccountSummaryScreen.kt (1)
698-718:⚠️ Potential issue | 🟠 MajorMove
overpaidcheck beforeclosedObligationsMetto prevent masking.The
overpaid == truebranch can be masked if a loan status has bothclosedObligationsMet == trueandoverpaid == trueset simultaneously. The first branch would match and return "Make Repayment", preventing the "Loan Overpaid" text from ever displaying. Reorder the conditions to checkoverpaidbefore theclosedObligationsMetcheck.Suggested reorder
`@Composable` fun getButtonText(status: LoanStatusEntity): String { return when { + status.overpaid == true -> { + stringResource(Res.string.feature_loan_overpaid) + } status.active == true || status.closedObligationsMet == true -> { stringResource(Res.string.feature_loan_make_Repayment) } @@ - status.overpaid == true -> { - stringResource(Res.string.feature_loan_overpaid) - } - else -> { stringResource(Res.string.feature_loan_closed) } } }
fix(feature/loan): display Overpaid status for overpaid loan accounts
3e78268 to
f3f4d5e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
feature/loan/src/commonMain/kotlin/com/mifos/feature/loan/loanAccountSummary/LoanAccountSummaryScreen.kt (1)
698-720:⚠️ Potential issue | 🟠 MajorMove
overpaidcheck beforeclosedObligationsMetto ensure correct status priority.The
overpaidcondition (line 712) is evaluated afterclosedObligationsMet(line 700). Since these flags are independent at the API level and both can be true simultaneously (as shown by the direct 1-to-1 mapping inGetClientsClientIdAccountMapper), an overpaid loan withclosedObligationsMet == truewill match the first condition and return "Make Repayment" instead of "Overpaid", making the overpaid check unreachable.Proposed fix
fun getButtonText(status: LoanStatusEntity): String { return when { + status.overpaid == true -> { + stringResource(Res.string.feature_loan_overpaid) + } + status.active == true || status.closedObligationsMet == true -> { stringResource(Res.string.feature_loan_make_Repayment) } status.pendingApproval == true -> { stringResource(Res.string.feature_loan_approve_loan) } status.waitingForDisbursal == true -> { stringResource(Res.string.feature_loan_disburse_loan) } - status.overpaid == true -> { - stringResource(Res.string.feature_loan_overpaid) - } - else -> { stringResource(Res.string.feature_loan_closed) } } }
|
Hi @Kartikey15dem, thanks for your PR. edit : tagged the wrong person :p |
Fixes - Jira-#MIFOSAC-637
Summary
Updated loan status handling to correctly display Overpaid for overpaid loan accounts in the Mobile App, aligning it with Web App behavior.
Issue
For overpaid loan accounts, the Web App correctly shows Overpaid, but the Mobile App was incorrectly displaying Loan Closed.
Behavior Changes
overpaidBef.webm
overpaidAft.webm
Fix
Added explicit handling for
status.overpaid == trueto ensure the correct button text/status is shown.Steps to Verify
000000016shows Overpaid.Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.