-
Notifications
You must be signed in to change notification settings - Fork 58
Review validations code #573
Comments
|
Is this part of #586 now? |
@mnquintana I think this thread is a good place to keep track of refactoring of existing code/functionality, where #586 is more for general restructuring discussion |
Ok, so the errors added in the However, this is dumb because our method We should distinguish the kind of validation that is 'essential' (and should be an official ActiveRecord validation) and 'softer' validations, that are dependent on many external factors and that can be overwritten by admins/checkout people. These latter validations will be easier to deal with outside of the stricter conditions required for ActiveRecord validations. Essential ActiveRecord validations:
|
We should review the code in models/reservation_validations.rb, and clean it up. Some functions may not be used any more (no_overdue_reservations? ?), we should use scopes where they exist rather than duplicate SQL queries, edge cases which say "return true" to avoid errors should maybe be reevaluated (not_renewable?), and we should make sure validations run over the correct sets rather than over everything always (not_renewable? should use the "active" scope).
Additionally, do the errors added in the validation tests get called or used anywhere? We add errors manually in validate_set. If this duplication serves no purpose, we could greatly simplify our validations by turning them into straightforward booleans.
The text was updated successfully, but these errors were encountered: