WEB-467 Interest rates field allows zero and negative values in loan product creation form
Changes Made :-
-Added validation to ensure the "Interest Rates" fields (minimum, default, and maximum nominal interest rates) only accept positive decimal values (minimum 1, e.g., 1.1) in the Create Loan Product form.
Before :-
After :-
Summary by CodeRabbit
-
Bug Fixes
- Interest rate inputs enforce a minimum of 0 and display separate, context-aware validation messages for required, minimum and decimal-precision errors.
-
New Features
- Inputs accept finer increments to allow values with up to six decimal places.
-
Documentation / Localization
- Added localized validation message "Only up to 6 decimal places allowed" in multiple languages.
✏️ Tip: You can customize this high-level summary in your review settings.
[!NOTE]
.coderabbit.yamlhas unrecognized propertiesCodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.
⚠️ Parsing warnings (1)
Validation error: Unrecognized key(s) in object: 'pre_merge_checks'⚙️ Configuration instructions
- Please see the configuration documentation for more information.
- You can also validate your configuration using the online YAML validator.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation:
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
Walkthrough
Added Validators.min(0) and a six-decimal-place pattern to three interest-rate form controls; updated numeric inputs with min/step attributes and per-error <mat-error> rendering; normalized comma-to-dot decimal separators in the getter; added "Only up to 6 decimal places allowed" translation key across many locale files.
Changes
| Cohort / File(s) | Summary |
|---|---|
Interest rate validators — TypeScript src/app/products/loan-products/loan-product-stepper/loan-product-terms-step/loan-product-terms-step.component.ts |
Added Validators.min(0) and a pattern limiting to up to six decimal places for minInterestRatePerPeriod, interestRatePerPeriod, and maxInterestRatePerPeriod; kept Validators.required on interestRatePerPeriod; updated form initialization and the loanProductTerms getter normalizes commas to dots for those fields before returning. |
Template updates — HTML src/app/products/loan-products/loan-product-stepper/loan-product-terms-step/loan-product-terms-step.component.html |
Added step="0.000001" and min/[min] attributes on numeric inputs; replaced previous single/unconditional error blocks with separate conditional <mat-error> blocks for required, min, and pattern errors and updated messages to reference decimal precision. |
Translations — locale JSONs src/assets/translations/... src/assets/translations/en-US.json, de-DE.json, fr-FR.json, es-CL.json, es-MX.json, it-IT.json, pt-PT.json, ko-KO.json, lt-LT.json, lv-LV.json, ne-NE.json, sw-SW.json, cs-CS.json |
Added labels.commons.Only up to 6 decimal places allowed localized entry in multiple locale files (some files contain duplicate insertions). No logic changes in translations. |
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~25 minutes
- Pay special attention to:
- The decimal pattern regex correctness and edge cases (integers, trailing zeros, comma vs dot).
- Template vs validator consistency for
min/[min],step, andValidators.min(0). - The comma-to-dot normalization in the getter and its interaction with validation/display.
- Duplicate or misplaced translation key insertions across locale files.
Possibly related PRs
- openMF/web-app#2859 — Similar changes to interest-rate form controls and templates (adds non-negative min constraints and more specific error handling).
Suggested reviewers
- IOhacker
- alberto-art3ch
Pre-merge checks and finishing touches
✅ 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 clearly identifies the main issue (WEB-467) and describes the primary change: validation to prevent zero and negative values in interest rate fields. |
| Docstring Coverage | ✅ Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. |
✨ 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.
Comment @coderabbitai help to get the list of available commands and usage tips.
So the minimum value will be 0 and it can also be in decimal like 0.1 , etc ?
Yes, value can be 0. Also values like 0.1 and .01 some regulation requieres up to 6 decimals
El vie., 12 de diciembre de 2025 5:16 p. m., Soni Jay < @.***> escribió:
JaySoni1 left a comment (openMF/web-app#2891) https://github.com/openMF/web-app/pull/2891#issuecomment-3648474344
So the minimum value will be 0 and it can also be in decimal like 0.1 , etc ?
— Reply to this email directly, view it on GitHub https://github.com/openMF/web-app/pull/2891#issuecomment-3648474344, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALD2ZASKHQRAMFXTEGN6RST4BNEDBAVCNFSM6AAAAACO4K4WUWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTMNBYGQ3TIMZUGQ . You are receiving this because you commented.Message ID: @.***>
Ok @IOhacker I will update the PR soon
@IOhacker I have updated this PR please review
LGTM
@alberto-art3ch I have updated the PR please review