Skip to content

fix(feature/loan): display Overpaid status for overpaid loan accounts#2592

Closed
Kartikey15dem wants to merge 1 commit intoopenMF:developmentfrom
Kartikey15dem:fix/overpaid-loan-statu
Closed

fix(feature/loan): display Overpaid status for overpaid loan accounts#2592
Kartikey15dem wants to merge 1 commit intoopenMF:developmentfrom
Kartikey15dem:fix/overpaid-loan-statu

Conversation

@Kartikey15dem
Copy link
Contributor

@Kartikey15dem Kartikey15dem commented Jan 31, 2026

Fixes - Jira-#Issue_Number

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.

Fix

Added explicit handling for status.overpaid == true to ensure the correct button text/status is shown.

Steps to Verify

  1. Open the client loan list in the Web App → Account 000000016 shows Overpaid.
  2. Open the same account in the Mobile App → Status now shows Overpaid.

Summary by CodeRabbit

  • New Features
    • Enhanced loan status visibility: accounts that have exceeded payments now show an "Overpaid" label, and the loan account summary displays this status on the action button for clearer account standing.

✏️ Tip: You can customize this high-level summary in your review settings.

Copilot AI review requested due to automatic review settings January 31, 2026 13:05
@coderabbitai
Copy link

coderabbitai bot commented Jan 31, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

Added a new string resource feature_loan_overpaid ("Loan Overpaid") and updated LoanAccountSummaryScreen to return this string when a loan's status.overpaid is true.

Changes

Cohort / File(s) Summary
Strings + UI logic
feature/loan/src/commonMain/composeResources/values/strings.xml, feature/loan/src/commonMain/kotlin/com/mifos/feature/loan/loanAccountSummary/LoanAccountSummaryScreen.kt
Inserted feature_loan_overpaid string resource and extended getButtonText() to return it when status.overpaid is true.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Suggested reviewers

  • itsPronay
  • TheKalpeshPawar
  • revanthkumarJ

Poem

🐰
I found a loan with extra cheer,
"Overpaid" now whispers near,
A tiny string, a button bright,
The summary shows it just right,
Hooray — the numbers sit polite! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding display of 'Overpaid' status for overpaid loan accounts, which aligns with the file changes and PR objectives.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request fixes loan status display in the Mobile App to correctly show "Overpaid" for overpaid loan accounts, matching the Web App behavior. Previously, overpaid loans were incorrectly displayed as "Loan Closed".

Changes:

  • Added explicit handling for status.overpaid == true in the getButtonText() function
  • Added new string resource "Loan Overpaid" for displaying the overpaid status

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 Added import for overpaid string resource and new condition in getButtonText() to return "Loan Overpaid" when loan status is overpaid
feature/loan/src/commonMain/composeResources/values/strings.xml Added new string resource "feature_loan_overpaid" with value "Loan Overpaid"

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +712 to +714
status.overpaid == true -> {
stringResource(Res.string.feature_loan_overpaid)
}
Copy link

Copilot AI Jan 31, 2026

Choose a reason for hiding this comment

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

The condition for checking overpaid status is placed after the closedObligationsMet check. This is a logic error because when a loan is overpaid, it typically also has closedObligationsMet set to true. As a result, the first condition (line 700) will match and return "Make Repayment" instead of checking for overpaid status. The overpaid condition needs to be checked BEFORE closedObligationsMet to ensure it takes precedence.

Copilot uses AI. Check for mistakes.
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@feature/loan/src/commonMain/composeResources/values/strings.xml`:
- Line 111: The string resource feature_loan_overpaid currently reads "Loan
Overpaid" but should match the Web App label "Overpaid"; update the XML value
for the string resource named feature_loan_overpaid to "Overpaid" so mobile and
web labels are consistent (ensure no other occurrences override it).
🧹 Nitpick comments (1)
feature/loan/src/commonMain/kotlin/com/mifos/feature/loan/loanAccountSummary/LoanAccountSummaryScreen.kt (1)

698-716: Move the overpaid check before active and closedObligationsMet to ensure it takes precedence.

If a loan status can have both active and overpaid flags true simultaneously, the current ordering will shadow the overpaid case and always show "Make Repayment". Although the codebase does not explicitly prevent this flag combination, defensive ordering is safer. Consider prioritizing overpaid checks first.

✅ Safer ordering
 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)
     }
 }

<string name="feature_loan_closed">Loan Closed</string>
<string name="feature_loan_total_loan">Total Loan</string>

<string name="feature_loan_overpaid">Loan Overpaid</string>
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Align the label with the expected “Overpaid” text.

PR objective says the mobile label should match the Web App’s “Overpaid”, but this string reads “Loan Overpaid”. That creates a visible mismatch.

✏️ Suggested update
-    <string name="feature_loan_overpaid">Loan Overpaid</string>
+    <string name="feature_loan_overpaid">Overpaid</string>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<string name="feature_loan_overpaid">Loan Overpaid</string>
<string name="feature_loan_overpaid">Overpaid</string>
🤖 Prompt for AI Agents
In `@feature/loan/src/commonMain/composeResources/values/strings.xml` at line 111,
The string resource feature_loan_overpaid currently reads "Loan Overpaid" but
should match the Web App label "Overpaid"; update the XML value for the string
resource named feature_loan_overpaid to "Overpaid" so mobile and web labels are
consistent (ensure no other occurrences override it).

@Kartikey15dem Kartikey15dem force-pushed the fix/overpaid-loan-statu branch from 78262fb to b96e68d Compare January 31, 2026 13:28
@Kartikey15dem Kartikey15dem deleted the fix/overpaid-loan-statu branch January 31, 2026 13:33
@Kartikey15dem Kartikey15dem restored the fix/overpaid-loan-statu branch January 31, 2026 13:34
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.

1 participant