-
Notifications
You must be signed in to change notification settings - Fork 849
WEB-569 Negative values allowed for repayment event days in loan product creation form #2984
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
Conversation
|
Note
|
| Cohort / File(s) | Summary |
|---|---|
Loan Product Settings Step src/app/products/loan-products/loan-product-stepper/loan-product-settings-step/loan-product-settings-step.component.html, src/app/products/loan-products/loan-product-stepper/loan-product-settings-step/loan-product-settings-step.component.ts |
Added min="0" to numeric inputs for due/overdue days and added Validators.min(0) to the corresponding form controls. Removed one empty line in the TypeScript file (formatting). |
Estimated code review effort
🎯 1 (Trivial) | ⏱️ ~4 minutes
Suggested reviewers
- IOhacker
- alberto-art3ch
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check | ✅ Passed | The title directly and accurately describes the main change: preventing negative values for repayment event days in the loan product creation form. |
| Docstring Coverage | ✅ Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. |
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
✨ Finishing touches
- 📝 Generate docstrings
📜 Recent review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/app/products/loan-products/loan-product-stepper/loan-product-settings-step/loan-product-settings-step.component.htmlsrc/app/products/loan-products/loan-product-stepper/loan-product-settings-step/loan-product-settings-step.component.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- src/app/products/loan-products/loan-product-stepper/loan-product-settings-step/loan-product-settings-step.component.ts
- src/app/products/loan-products/loan-product-stepper/loan-product-settings-step/loan-product-settings-step.component.html
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 @coderabbitai help to get the list of available commands and usage tips.
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: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
src/app/products/loan-products/loan-product-stepper/loan-product-settings-step/loan-product-settings-step.component.html (2)
761-767: Correct the tooltip and consider adding validation error message.The tooltip text "Maximum outstanding loan account balance" appears to be copy-pasted from the outstanding balance field and doesn't match the purpose of "Due days for repayment event."
Additionally, while the
min="0"HTML attribute is added, there's no<mat-error>block to inform users when they violate this constraint, which could lead to confusion.Suggested improvements
Update the tooltip to describe repayment event days:
<input type="number" min="0" matInput - matTooltip="{{ 'tooltips.Maximum outstanding loan account balance' | translate }}" + matTooltip="{{ 'tooltips.Number of days before repayment due date for event notification' | translate }}" formControlName="dueDaysForRepaymentEvent" />Consider adding a validation error message:
formControlName="dueDaysForRepaymentEvent" /> + @if (loanProductSettingsForm.controls.dueDaysForRepaymentEvent.hasError('min')) { + <mat-error> + {{ 'labels.inputs.Due days for repayment event' | translate }} + {{ 'labels.commons.must be' | translate }} + <strong>{{ 'labels.commons.non-negative' | translate }}</strong> + </mat-error> + } </mat-form-field>
771-777: Correct the tooltip and consider adding validation error message.Similar to the "Due days" field above, the tooltip text is incorrect and there's no validation error message.
Suggested improvements
Update the tooltip:
<input type="number" min="0" matInput - matTooltip="{{ 'tooltips.Maximum outstanding loan account balance' | translate }}" + matTooltip="{{ 'tooltips.Number of days after repayment due date for overdue event notification' | translate }}" formControlName="overDueDaysForRepaymentEvent" />Consider adding a validation error message:
formControlName="overDueDaysForRepaymentEvent" /> + @if (loanProductSettingsForm.controls.overDueDaysForRepaymentEvent.hasError('min')) { + <mat-error> + {{ 'labels.inputs.OverDue days for repayment event' | translate }} + {{ 'labels.commons.must be' | translate }} + <strong>{{ 'labels.commons.non-negative' | translate }}</strong> + </mat-error> + } </mat-form-field>
🤖 Fix all issues with AI agents
In
@src/app/products/loan-products/loan-product-stepper/loan-product-settings-step/loan-product-settings-step.component.html:
- Line 763: Update the form control definitions for dueDaysForRepaymentEvent and
overDueDaysForRepaymentEvent to include Validators.min(0) so validation is
enforced in TypeScript (not just via HTML). Locate the FormGroup or FormBuilder
usage that defines these controls (look for the keys "dueDaysForRepaymentEvent"
and "overDueDaysForRepaymentEvent" in the loan-product-settings-step component)
and add Validators.min(0) alongside any existing validators (e.g.,
Validators.required or Validators.pattern) for each control.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/app/products/loan-products/loan-product-stepper/loan-product-settings-step/loan-product-settings-step.component.htmlsrc/app/products/loan-products/loan-product-stepper/loan-product-settings-step/loan-product-settings-step.component.ts
💤 Files with no reviewable changes (1)
- src/app/products/loan-products/loan-product-stepper/loan-product-settings-step/loan-product-settings-step.component.ts
🧰 Additional context used
📓 Path-based instructions (1)
src/app/**
⚙️ CodeRabbit configuration file
src/app/**: For Angular code: verify component separation, trackBy on *ngFor,
strict type safety, and clean observable patterns.
Files:
src/app/products/loan-products/loan-product-stepper/loan-product-settings-step/loan-product-settings-step.component.html
🧠 Learnings (2)
📓 Common learnings
Learnt from: alberto-art3ch
Repo: openMF/web-app PR: 2876
File: src/app/loans/loans-view/loan-account-actions/loan-reaging/loan-reaging.component.ts:91-94
Timestamp: 2025-12-09T14:24:31.429Z
Learning: In the LoanReagingComponent (src/app/loans/loans-view/loan-account-actions/loan-reaging/loan-reaging.component.ts), the transactionAmount field uses both Validators.min and Validators.max set to the same value (loanTransactionData.amount). This is intentional - it requires users to enter the exact amount as a confirmation/validation step before submitting the re-age operation.
📚 Learning: 2025-12-09T14:24:31.429Z
Learnt from: alberto-art3ch
Repo: openMF/web-app PR: 2876
File: src/app/loans/loans-view/loan-account-actions/loan-reaging/loan-reaging.component.ts:91-94
Timestamp: 2025-12-09T14:24:31.429Z
Learning: In the LoanReagingComponent (src/app/loans/loans-view/loan-account-actions/loan-reaging/loan-reaging.component.ts), the transactionAmount field uses both Validators.min and Validators.max set to the same value (loanTransactionData.amount). This is intentional - it requires users to enter the exact amount as a confirmation/validation step before submitting the re-age operation.
Applied to files:
src/app/products/loan-products/loan-product-stepper/loan-product-settings-step/loan-product-settings-step.component.html
...ts/loan-product-stepper/loan-product-settings-step/loan-product-settings-step.component.html
Show resolved
Hide resolved
…uct Creation Form
b1df9d8 to
3aa7742
Compare
|
@IOhacker Thank you for the review |
Changes Made :-
-Added min="0" attribute to the input fields for "Due days for repayment event" and "OverDue days for repayment event" to prevent users from entering negative values.
-Added Angular form validation (Validators.min(0)) for these fields to ensure negative values are not accepted at the form level.
WEB-569
Before :-

After :-

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