This repository was archived by the owner on Jul 27, 2025. It is now read-only.
Fix Account Holding validation and synchronization#1818
Merged
Conversation
Fixes #1781
- Add comprehensive validations for Account::Holding
- Implement validation to ensure amount matches qty * price
- Update Account::Syncer to include qty and price during synchronization
- Add database constraints for holding attributes and calculations
Member
Author
zachgoll
approved these changes
Feb 6, 2025
Contributor
zachgoll
left a comment
There was a problem hiding this comment.
Yep, that's pretty much what I was thinking!
db/migrate/20250206204404_add_constraints_to_account_holdings.rb
Outdated
Show resolved
Hide resolved
Align with project convention of keeping complex validations in ActiveRecord - Remove database-level check constraints for quantity, price, and amount - Maintain database-level null and unique constraints - Prepare for more flexible validation in the model layer
pranav7
pushed a commit
to pranav7/maybe
that referenced
this pull request
Mar 2, 2025
* Fix Account Holding validation and synchronization
Fixes #1781
- Add comprehensive validations for Account::Holding
- Implement validation to ensure amount matches qty * price
- Update Account::Syncer to include qty and price during synchronization
- Add database constraints for holding attributes and calculations
* Remove database check constraints for Account Holdings
Align with project convention of keeping complex validations in ActiveRecord
- Remove database-level check constraints for quantity, price, and amount
- Maintain database-level null and unique constraints
- Prepare for more flexible validation in the model layer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1781