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

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 readthedocs/core Jul 25, 2019

@ericholscher
Copy link
Member

left a comment

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

This comment has been minimized.

Copy link
Member Author

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

This comment has been minimized.

Copy link
Member

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

This comment has been minimized.

Copy link
Member Author

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 readthedocs/core Aug 1, 2019

@humitos

This comment has been minimized.

Copy link
Member

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.

readthedocs/builds/managers.py Outdated Show resolved Hide resolved

@stsewd stsewd requested a review from readthedocs/core Aug 14, 2019

@ericholscher
Copy link
Member

left a comment

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

This comment has been minimized.

Copy link
Member Author

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

2 checks passed

continuous-documentation/read-the-docs Read the Docs build succeeded!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@stsewd stsewd deleted the stsewd:update-automation-rules-model branch Aug 26, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.