Skip to content

Conversation

mbertrand
Copy link
Member

@mbertrand mbertrand commented Oct 6, 2025

What are the relevant tickets?

https://github.com/mitodl/hq/issues/6074

Description (What does it do?)

Sorts runs by start_date (and then enrollment_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 by start_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 of course-v1:MITxT+8.01.4x and verify they are still sorted by start_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.

@mbertrand mbertrand added Work in Progress Needs Review An open Pull Request that is ready for review and removed Work in Progress labels Oct 6, 2025
@abeglova abeglova self-assigned this Oct 7, 2025
Copy link
Contributor

@abeglova abeglova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sort shows oldest runs first. Since newer runs are most likely to be relevant i think it makes more sense to sort the runs from newest to oldest instead

@mbertrand mbertrand merged commit 88fd656 into main Oct 7, 2025
13 checks passed
@mbertrand mbertrand deleted the mb/sorted_runs branch October 7, 2025 18:46
This was referenced Oct 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Review An open Pull Request that is ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants