fix(standing-instruction): reject non-positive and non-numeric amounts#2028
fix(standing-instruction): reject non-positive and non-numeric amounts#2028bhuvan-somisetty wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR updates amount validation in standing instruction creation to strengthen input validation. The change replaces digit-only checking with floating-point numeric parsing and adds a guard to reject zero or negative amounts. ChangesStanding Instruction Amount Validation
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
|
Hi, @bhuvan-somisetty We appreciate your contribution. To facilitate seamless integration and collaboration, please ensure you have joined our Slack workspace and the relevant designated channel. We recommend thoroughly reviewing the bookmark pages, project README, and wiki to gain a comprehensive understanding of the project architecture and development guidelines. Active participation in the daily stand-up meetings is encouraged for discussions, ticket assignments, and to foster connections with the development team. Prior to requesting an assignment in the channel, please create a Jira ticket or ask for an assignment of existing tickets. All pull request descriptions must comprehensively detail the before and after changes, substantiated by relevant video or image evidence. |
Signed-off-by: bhuvan-somisetty <somisettybhuvan5@gmail.com>
60825e7 to
b36cf44
Compare
|
Thanks for the pointers - I'll make sure to join the Slack workspace and the project channel, and go through the README/wiki and Jira board before picking up further work. Rebased this PR onto latest dev in the meantime; the fix and manual test steps are described above (10.50 / 0 / -5 / abc cases). Happy to add anything else needed for review. |
The amount validation in
AddEditSIViewModelusedany { !it.isDigit() }to catch invalid input, butisDigit()returns false for., so any decimal amount like10.50was rejected with "Amount is Invalid" even though the amount field usesKeyboardType.Numberwhich allows decimal separators.Replaced the character-level digit check with
toDoubleOrNull() == nullfor format validation, and added a<= 0guard to reject zero and negative amounts. The null-path message is corrected to "Amount is Invalid" rather than the previous "Amount is Required".Tested manually by entering
10.50,0,-5, andabcin the standing instruction form to confirm each case is handled correctly.Summary by CodeRabbit