Skip to content

Conversation

@JaySoni1
Copy link
Contributor

@JaySoni1 JaySoni1 commented Feb 9, 2026

Changes Made :-

-Changed default values for [dueDaysForRepaymentEvent and [overDueDaysForRepaymentEvent] fields from inheriting global configuration value to empty string, allowing users to enter their own values when creating new loan products while preserving existing values when editing.

WEB-685

Before :-

image

After :-

image

Summary by CodeRabbit

  • Bug Fixes
    • Improved loan product repayment configuration handling to ensure proper initialization and reset of settings. Repayment event fields are now correctly managed based on configuration state, providing more reliable behavior when saving or resetting loan product settings.

@coderabbitai
Copy link

coderabbitai bot commented Feb 9, 2026

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit 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

The loan product settings component now conditionally patches repayment event fields during edit mode only when both values exist, and explicitly resets configurations when not editing by setting useDueForRepaymentsConfigurations to false and clearing day fields to empty strings instead of null.

Changes

Cohort / File(s) Summary
Repayment Event Configuration Logic
src/app/products/loan-products/loan-product-stepper/loan-product-settings-step/loan-product-settings-step.component.ts
Modified conditional patching of repayment event day fields during edit mode to only update when both dueDaysForRepaymentEvent and overDueDaysForRepaymentEvent exist; non-edit mode now explicitly sets useDueForRepaymentsConfigurations to false and clears fields to empty strings instead of null values.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

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 clearly and specifically describes the main change: fixing default values for due/overdue days repayment event fields in loan product creation, which aligns with the code changes.
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
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

No actionable comments were generated in the recent review. 🎉

🧹 Recent nitpick comments
src/app/products/loan-products/loan-product-stepper/loan-product-settings-step/loan-product-settings-step.component.ts (1)

172-195: Fragile interaction: patchValue triggers valueChanges mid-patch, relying on object key order.

Setting useDueForRepaymentsConfigurations inside the same patchValue call that also sets dueDaysForRepaymentEvent / overDueDaysForRepaymentEvent causes the valueChanges subscription (line 662) to fire synchronously mid-patch. That subscription patches the same two fields to either null (when true) or global-config values (when false). The final field values are only correct because JavaScript iterates object keys in insertion order, so the explicit '' values win.

This is subtle and easy to break in a future refactor. A safer approach is to separate the two patches so the subscription completes first:

Suggested refactor
     if (this.toEdit) {
       if (
         this.loanProductsTemplate.dueDaysForRepaymentEvent != null &&
         this.loanProductsTemplate.overDueDaysForRepaymentEvent != null
       ) {
-        this.loanProductSettingsForm.patchValue({
-          useDueForRepaymentsConfigurations: false,
-          dueDaysForRepaymentEvent: this.loanProductsTemplate.dueDaysForRepaymentEvent,
-          overDueDaysForRepaymentEvent: this.loanProductsTemplate.overDueDaysForRepaymentEvent
-        });
+        this.loanProductSettingsForm.patchValue({ useDueForRepaymentsConfigurations: false });
+        this.loanProductSettingsForm.patchValue({
+          dueDaysForRepaymentEvent: this.loanProductsTemplate.dueDaysForRepaymentEvent,
+          overDueDaysForRepaymentEvent: this.loanProductsTemplate.overDueDaysForRepaymentEvent
+        });
       } else {
-        this.loanProductSettingsForm.patchValue({
-          useDueForRepaymentsConfigurations: true,
-          dueDaysForRepaymentEvent: '',
-          overDueDaysForRepaymentEvent: ''
-        });
+        this.loanProductSettingsForm.patchValue({ useDueForRepaymentsConfigurations: true });
+        this.loanProductSettingsForm.patchValue({
+          dueDaysForRepaymentEvent: '',
+          overDueDaysForRepaymentEvent: ''
+        });
       }
     } else {
-      this.loanProductSettingsForm.patchValue({
-        useDueForRepaymentsConfigurations: false,
-        dueDaysForRepaymentEvent: '',
-        overDueDaysForRepaymentEvent: ''
-      });
+      this.loanProductSettingsForm.patchValue({ useDueForRepaymentsConfigurations: false });
+      this.loanProductSettingsForm.patchValue({
+        dueDaysForRepaymentEvent: '',
+        overDueDaysForRepaymentEvent: ''
+      });
     }

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
Collaborator

@alberto-art3ch alberto-art3ch left a comment

Choose a reason for hiding this comment

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

Could we review this requiremente? Because those two product parameters by default will came from Global Configuration variables (useDueForRepaymentsConfigurations = true)

The users (If they want) can to override them, but by default the initial values must be from the configurations

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.

2 participants