-
Notifications
You must be signed in to change notification settings - Fork 11
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
Single taxonomy view [FC-0030] #78
Single taxonomy view [FC-0030] #78
Conversation
Thanks for the pull request, @ChrisChV! Please note that it may take us up to several weeks or months to complete a review and merge your PR. Feel free to add as much of the following information to the ticket as you can:
All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here. Please let us know once your PR is ready for our review and all tests are green. |
@bradenmacdonald Do you have any idea why quality errors occur? We have the same syntax here and here |
@ChrisChV Yes, it's very simple - you need to put |
tag_set = self.tag_set.all() | ||
|
||
if self.allow_free_text: | ||
return tag_set.none() |
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'm not really a big fan of the idea that we have to call different APIs to get the tags based on the type of taxonomy. It would be nice if the API could handle that implementation detail internally. We can think about this for later though.
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.
Do you mean having two functions? get_tags
and get_filtered_tags
?
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.
No I mean for example that it would be nice if search_tags
worked for any taxonomy, but right now it only works for taxonomies that aren't free text. We can change that in the future though; no change for now. After all we have excluded free text from the MVP anyways.
|
||
class TagsPagination(DefaultPagination): | ||
""" | ||
Custom paginator that returns the range index of the current page |
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.
Why is this useful/necessary? As far as I can see, we're not using it (yet).
It's always a good idea to put the "why" into the docstring so that in the future people know why it's here and can remove the code if it's not needed. If we don't say why and it never gets used, the code may sit around forever anyways, if nobody knows whether it's important or not.
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.
If it's for openedx/modular-learning#111 , I'm actually going to suggest that we exclude that from the MVP or at least do it later as part of Step 4, not implement it now in Step 2.
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.
It's always a good idea to put the "why" into the docstring so that in the future people know why it's here and can remove the code if it's not needed.
It is because of this discussion. The range index of the current page is shown in the UI
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.
If it's for openedx/modular-learning#111 , I'm actually going to suggest that we exclude that from the MVP or at least do it later as part of Step 4, not implement it now in Step 2.
Ok, I see. In that case, should I remove everything related to range index?
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 updated this here: 6dded73
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.
Yeah, that's more of a UI thing. Especially when we're tight for budget, let's exclude it for now and we can consider adding it later when we implement that story. Also I think it makes more sense to implement it generally for the whole platform, not just for the tagging use case.
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.
Also I think it makes more sense to implement it generally for the whole platform, not just for the tagging use case.
I have implemented it that way because of how special this tag view is. We have to change the paginator to disable pagination in that view.
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.
Ah ok. Well if you want to keep what you have it's fine with me. I just don't want to spend any more time on it now.
I'm not sure why the CLA check isn't working. Please rebase/squash this tomorrow and ping me to merge ; hopefully the check is fixed by then. |
docs: ADR for pagination and repr of single taxonomy api feat: Initial view and pagination config feat: get_range_index added to paginator feat: View for get tags - Get paginated root tags - Get paginated children tags - Get all tags for small taxonomies - Tags structure for response chore: Adding permissions and docstrings style: quality feat: Search added to get tags view feat: searching tags docs: Adding comments on the view docs: Update ADR with search logic chore: fix quality checks chore: fix tests style: Nits on type hints and docstrings and comments fix: Delete all about range index in paginators
6dded73
to
d7e5872
Compare
@bradenmacdonald Done |
@ChrisChV 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future. |
Description
Adds a new view to return tags for a given taxonomy. With this view, you can:
Also updates the ADR 0014 with some logics on search.
Supporting Information
Testing Instructions
python manage.py runserver