Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What are the relevant tickets?
https://github.com/mitodl/hq/issues/6074
Description (What does it do?)
Sorts runs by
start_date
(and thenenrollment_start
,id
if prior attribute is null or the same) across several API's (LearningResourceViewSet
,ResourceListItemsViewSet
)How can this be tested?
On the main branch, run
./manage.py backpopulate_mitxonline_data
if you haven't already, and wait for the search upsert tasks to finish.Switch to this branch.
Find the id of the resource with
readable_id=course-v1:MITxT+8.01.4x
Go to
http://open.odl.local:8063/api/v1/learning_resources/<course_id>/
- the course should have multiple published runs, check that they are in order bystart_date
Find the id of the program with
readable_id=program-v1:MITxT+8.01x
Go to
http://open.odl.local:8063/api/v1/learning_resources/<program_id>/items/
- search for the runs ofcourse-v1:MITxT+8.01.4x
and verify they are still sorted bystart_date
Go to
http://open.odl.local:8063/api/v1/learning_resources_search/?id=<course_id>
- the runs probably won't be in the correct order.Run
./manage.py backpopulate_mitxonline_data
again. After search updates are done, check the url above again, this time the runs should be in the correct order.