-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Add manager and description field to AutomationRule model #5995
Add manager and description field to AutomationRule model #5995
Conversation
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.
Not sure I follow this code completely. Is this just a helper to handle assigning a priority if a user doesn't set one?
Yes, it's a helper. But it's always used, modifying priorities manually should never happen. We have a constraint of unique (project, priority), so the user would need to modify all priorities to change one, we don't want that. When a rule is created it's added at the end, we can get more fancy inserting the priority between others. But this is the basic thing needed for the basic UI (#5996). There is another helper to move priorities (up or down) #5998 |
Why we don't remove this constraint from the DB and manage this from the code only? This will make our life easier and help with #5998 to make a way more simpler implementation. |
Just a note that if we remove the constraint, we still shouldn't let users change the priority manually (they still will need to change all priorities). My point for keep the constraint is that it's more easy to keep the check at the db level than in several places. |
Yes, this makes sense to me.
Well, I was suggesting to remove it because I think the problem that it brings are higher than the benefits. Our code gets more complicated only because of the constrain and I do not see too much value on having the constrain at a db level at this point. |
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.
This looks pretty simple. It likely needs a bit more explanation. Do we have docs somewhere on why this model is using django-polymorphic?
No, but it was used to add more rules #4001
|
While implementing the UI for automation rules, I found that we need a description.
And a manager to help us to add new rules without taking into account the priority.