fix(WEB-1054): allow updating zero-interest loan products - #3754
Conversation
|
Note
|
| Layer / File(s) | Summary |
|---|---|
Interest-rate value derivation src/app/products/loan-products/loan-product-stepper/loan-product-terms-step/loan-product-terms-step.component.ts |
The zero-interest toggle uses shared helpers to return blank values for zero-interest templates or configured min/default/max values for positive-interest templates. |
Interest-rate behavior tests src/app/products/loan-products/loan-product-stepper/loan-product-terms-step/loan-product-terms-step.component.spec.ts |
Unit tests cover toggling to positive interest, preserving configured bounds, and retaining zero-interest values after initialization. |
Estimated code review effort: 2 (Simple) | ~10 minutes
Possibly related PRs
- openMF/web-app#3701: Updates related interest-rate labels and headings in the loan product terms step.
Suggested reviewers: alberto-art3ch
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | 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 (4 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check | ✅ Passed | The title clearly matches the main change: enabling updates to zero-interest loan products. |
| Linked Issues check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
✨ Finishing Touches
🧪 Generate unit tests (beta)
- Create PR with unit tests
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.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/app/products/loan-products/loan-product-stepper/loan-product-terms-step/loan-product-terms-step.component.ts (1)
659-673: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winReplace the
anyreturn contract.Use
number | ''for the three values so the zero-interest blank-state contract remains type-checked.Proposed fix
- private getInterestRateValues(): { min: any; default: any; max: any } { + private getInterestRateValues(): { min: number | ''; default: number | ''; max: number | '' } {🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/app/products/loan-products/loan-product-stepper/loan-product-terms-step/loan-product-terms-step.component.ts` around lines 659 - 673, Update the return type of getInterestRateValues to use number | '' for min, default, and max instead of any, preserving the existing blank-string zero-interest behavior and numeric template values.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In
`@src/app/products/loan-products/loan-product-stepper/loan-product-terms-step/loan-product-terms-step.component.ts`:
- Around line 659-673: Update the return type of getInterestRateValues to use
number | '' for min, default, and max instead of any, preserving the existing
blank-string zero-interest behavior and numeric template values.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: e158d701-97c5-48e8-8d93-111c86fc8d64
📒 Files selected for processing (2)
src/app/products/loan-products/loan-product-stepper/loan-product-terms-step/loan-product-terms-step.component.spec.tssrc/app/products/loan-products/loan-product-stepper/loan-product-terms-step/loan-product-terms-step.component.ts
Summary
Fixes WEB-1054 by correcting the Loan/Credit Product edit flow when updating a product that was originally created with a 0% interest rate.
The update request now sends consistent interest-rate values, allowing the product to be modified successfully when changing the interest rate from zero to a positive value while preserving existing behavior for other loan products.
Related Issue
WEB-1054
Summary by CodeRabbit
Bug Fixes
Tests