-
Notifications
You must be signed in to change notification settings - Fork 4.2k
feat: add pagination to the HomePageCoursesV2 API #34175
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
feat: add pagination to the HomePageCoursesV2 API #34175
Conversation
|
Thanks for the pull request, @mariajgrimaldi! 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. |
b76a4e9 to
4f15af1
Compare
f829a42 to
516dc90
Compare
4f15af1 to
b9c7322
Compare
e18468d to
113f4a1
Compare
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.
Note to reviewer: I'm a bit worried about the performance impact of this change, but this was one of the alternatives which included fewer changes to the current source code.
113f4a1 to
99fd94e
Compare
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.
Note to reviewer: I'm unsure how to handle this case. In this view, not only courses are returned, but also returns in_process_course_actions which is a list of CourseRerunState objects not necessarily related to the courses list so I'm not sure why they're currently returned together.
So I didn't add pagination to in_process_course_actions since I believe that that list should be returned by another different view dedicated only to course reruns state objects.
What do you think? That new view is out of the scope of this PR, so this new view returns the list of course reruns objects without pagination.
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 don't think we currently need this paginated list, I don't see a problem to leave it like that for the moment, and work on it later in a dedicated PR if necessary.
da58387 to
13bc1d5
Compare
b310100 to
8f44261
Compare
e7aab6f to
58725d3
Compare
|
Hi there @mariajgrimaldi! Could you please add |
58725d3 to
fab7ef0
Compare
|
Hi there @mariajgrimaldi! This is working as expected. My only concern is about setting the number of items peer page but is not a blocking is a nice to have. LGTM |
| }) | ||
| return Response(OrderedDict([ | ||
| ('count', paginator.page.paginator.count), | ||
| ('num_pages', paginator.page.paginator.num_pages), |
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.
Note to reviewer
I'm currently studying which parts of the implementation are affecting performance. Based on those results, this or the count might have to go.
581b0d8 to
9bdf9d1
Compare
db12a4f to
1f5c5fd
Compare
3387477 to
3d86f4f
Compare
1f5c5fd to
e59900e
Compare
|
I'll merge this PR to the V2 API implementation. |
|
@mariajgrimaldi 🎉 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
This PR builds pagination capabilities on top of the new HomePageCourses API version. These changes are intended to be used by the new Course Home MFE. The new API is based on HomePageCourses with tweaks, so it gets courses with Course Overview helpers that allow filtering, ordering, and pagination with Django/DRF methods and classes.
API changes compared to V1
Besides the changes mentioned here that add filtering/ordering capabilities, we:
Supporting information
For more information on this enhancement, please check:
https://openedx.atlassian.net/wiki/spaces/OEPM/pages/4032856101/Studio+Home+incremental+upgrades+-+product+approach
Testing instructions
Login as an administrator or as course staff (they should both work), then:

You can use your browser to get your list of courses from Studio
HTTP(s)://<CMS_HOST>/api/contentstore/v2/home/courseswhere the list of courses will appear paginated:Deadline
This effort is part of the Spanish consortium project, so it'd be ideal to merge this before the end of the project.
Other information
There are still some architectural decisions to be made around how to present data to the Studio Home MFE, ie. how to split active/archived courses. So, we'll be updating this PR accordingly.