-
Notifications
You must be signed in to change notification settings - Fork 0
add unit model #230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
add unit model #230
Conversation
| t.integer :daily_page_limit | ||
| t.integer :overall_page_limit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably have these configured as "null: false" and add some defaults just to be sure on the database level we are not getting anything weird. Probably something pretty restrictive like 30 pages a day and 25,000 total. We should confirm with @binkylush that this sounds okay.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Binky confirmed those are a good place to start
app/models/unit.rb
Outdated
| validates :daily_page_limit, presence: true | ||
| validates :overall_page_limit, presence: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these would be better like validates :daily_page_limit, numericality: { only_integer: true, greater_than_or_equal_to: 0 }. To be sure we know what we're getting won't cause issues downstream.
ajkiessl
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Fixes #226
For now, unit_id is allowed to be null for users so it doesn't break existing users. Once those have been assigned a unit, we should probably update so that users must have a unit to make sure pages are all accounted for