Skip to content
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

Merged
merged 9 commits into from
Aug 26, 2019

Conversation

stsewd
Copy link
Member

@stsewd stsewd commented Jul 25, 2019

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.

@stsewd stsewd requested a review from a team July 25, 2019 19:45
Copy link
Member

@ericholscher ericholscher left a 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?

readthedocs/builds/managers.py Show resolved Hide resolved
readthedocs/builds/models.py Outdated Show resolved Hide resolved
@stsewd
Copy link
Member Author

stsewd commented Jul 31, 2019

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

@humitos
Copy link
Member

humitos commented Jul 31, 2019

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.

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.

@stsewd
Copy link
Member Author

stsewd commented Jul 31, 2019

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.

@stsewd stsewd requested a review from a team August 1, 2019 04:20
@humitos
Copy link
Member

humitos commented Aug 1, 2019

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).

Yes, this makes sense to me.

My point for keep the constraint is that it's more easy to keep the check at the db level than in several places.

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.

@stsewd stsewd requested a review from a team August 14, 2019 17:04
Copy link
Member

@ericholscher ericholscher left a 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?

readthedocs/builds/managers.py Show resolved Hide resolved
@stsewd
Copy link
Member Author

stsewd commented Aug 26, 2019

Do we have docs somewhere on why this model is using django-polymorphic?

No, but it was used to add more rules #4001

  • Regex match (this one is done)
  • Most recent commit
  • Highest version branch/tag

@stsewd stsewd merged commit 59738a1 into readthedocs:master Aug 26, 2019
@stsewd stsewd deleted the update-automation-rules-model branch August 26, 2019 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants