Skip to content

Conversation

mbertrand
Copy link
Member

@mbertrand mbertrand commented Oct 2, 2025

What are the relevant tickets?

Closes https://github.com/mitodl/hq/issues/8778

Description (What does it do?)

Adjusts the ResourceListItemsViewSet.queryset filter out published runs and adds a few prefetches to get rid of some n+1 queries.

How can this be tested?

  • Run python manage.py backpopulate_mitxonline_data
  • Find the object id of the program "Data, Economics, and Design of Policy: Public Policy" (program-v1:MITx+DEDP-Public-Policy)
  • Find the object id of the course "Microeconomics" (course-v1:MITxT+14.100x)
  • Go to the url http://open.odl.local:8063/api/v1/learning_resources/<course_object_id>/, you should see one run there.
  • Go to the url http://open.odl.local:8063/api/v1/learning_resources/<program_object_id>/items/ and look for the course object id above. There should be just one run (published). If you look at that course resource in Django Admin you'll see multiple unpublished runs.

@abeglova abeglova self-assigned this Oct 2, 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.

lgtm

@mbertrand mbertrand force-pushed the mb/fix_items_runs_view branch from 66842cf to cb57fca Compare October 2, 2025 16:00
@mbertrand mbertrand merged commit c804fda into main Oct 2, 2025
13 checks passed
@mbertrand mbertrand deleted the mb/fix_items_runs_view branch October 2, 2025 16:16
@odlbot odlbot mentioned this pull request Oct 2, 2025
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants