Skip to content

Conversation

@JaySoni1
Copy link
Contributor

@JaySoni1 JaySoni1 commented Dec 9, 2025

Changes Made :-

Added validation to the "Lock-in Period" frequency field in the Create Share Product form to ensure only positive integer values greater than zero are allowed.

WEB-464

Before :-
image-20251203-031147 (1)

After :-
image

Summary by CodeRabbit

Release Notes

  • Improvements
    • Strengthened validation for the lock-in period frequency field to require completion and enforce a minimum value of 1. Clear error messages now display when validation requirements are not met.

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

@coderabbitai
Copy link

coderabbitai bot commented Dec 9, 2025

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

This pull request adds validation constraints to the lockinPeriodFrequency form field in the share product settings step. The TypeScript component now enforces that the field is required and must have a minimum value of 1, while the template displays corresponding error messages to users.

Changes

Cohort / File(s) Summary
Lock-in Period Frequency Validation
src/app/products/share-products/share-product-stepper/share-product-settings-step/share-product-settings-step.component.ts, src/app/products/share-products/share-product-stepper/share-product-settings-step/share-product-settings-step.component.html
Added form control validators (Validators.required, Validators.min(1)) to lockinPeriodFrequency. Updated template to enforce minimum value 1, step 1, and display mat-error messages for required and minimum value validation failures.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

  • Straightforward validation enhancement with consistent pattern across two files
  • No complex logic or control flow changes
  • Standard Angular form validation approach

Suggested reviewers

  • IOhacker

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title accurately summarizes the main change: adding validation to prevent zero and negative values in the Lock-in Period field. It is specific, clear, and directly reflects the changes in both the HTML and TypeScript files.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ 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

@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: 0

🧹 Nitpick comments (1)
src/app/products/share-products/share-product-stepper/share-product-settings-step/share-product-settings-step.component.html (1)

66-72: Localize the new validation messages for consistency with the rest of the form

The two new mat-error messages are hard-coded in English, while the rest of this template uses translation keys/pipes. Please switch these to use the translation system (e.g., similar to the nominalShares error above) so validation feedback is localized as well.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9b07218 and 017273f.

📒 Files selected for processing (2)
  • src/app/products/share-products/share-product-stepper/share-product-settings-step/share-product-settings-step.component.html (1 hunks)
  • src/app/products/share-products/share-product-stepper/share-product-settings-step/share-product-settings-step.component.ts (1 hunks)
🧰 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/share-products/share-product-stepper/share-product-settings-step/share-product-settings-step.component.html
  • src/app/products/share-products/share-product-stepper/share-product-settings-step/share-product-settings-step.component.ts
🧠 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:23.311Z
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:23.311Z
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:23.311Z
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/share-products/share-product-stepper/share-product-settings-step/share-product-settings-step.component.html
  • src/app/products/share-products/share-product-stepper/share-product-settings-step/share-product-settings-step.component.ts
🔇 Additional comments (1)
src/app/products/share-products/share-product-stepper/share-product-settings-step/share-product-settings-step.component.ts (1)

65-71: Verify integer validation requirement for lockinPeriodFrequency field

The suggestion to add Validators.pattern(/^[1-9]\d*$/) for integer validation is technically sound—Validators.min(1) alone does permit decimal values like 1.5. However, without confirming whether the lockinPeriodFrequency field must strictly be a positive integer (versus a numeric frequency that may accept decimals), this change cannot be verified against actual requirements.

Check the following before applying this change:

  • Is lockinPeriodFrequency documented or typed to require a whole number?
  • Do similar frequency fields elsewhere in the codebase use pattern validators for integer enforcement?
  • Does the backend API expect an integer or can it accept decimals?

If integer values are indeed required, the proposed pattern validator is the appropriate solution.

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.

LGTM

@JaySoni1 JaySoni1 changed the title WEB-464 Lock in Period Field Allows Zero and Negative Values in Saving Product Creation Form WEB-464 Lock in Period Field Allows Zero and Negative Values in Share Product Creation Form Dec 9, 2025
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