Skip to content
Snippets Groups Projects
Commit 0ed4ee32 authored by Don Mitchell's avatar Don Mitchell
Browse files

Use bulk operations on get_course_by_id and courseware

parent 0c795934
No related branches found
Tags release-2021-06-22-17.43
No related merge requests found
......@@ -66,7 +66,8 @@ def get_course_by_id(course_key, depth=0):
depth: The number of levels of children for the modulestore to cache. None means infinite depth
"""
course = modulestore().get_course(course_key, depth=depth)
with modulestore().bulk_operations(course_key):
course = modulestore().get_course(course_key, depth=depth)
if course:
return course
else:
......
......@@ -285,6 +285,11 @@ def index(request, course_id, chapter=None, section=None,
return redirect(reverse('dashboard'))
request.user = user # keep just one instance of User
with modulestore().bulk_operations(course_key):
return _index_bulk_op(request, user, course_key, chapter, section, position)
def _index_bulk_op(request, user, course_key, chapter, section, position):
course = get_course_with_access(user, 'load', course_key, depth=2)
staff_access = has_access(user, 'staff', course)
registered = registered_for_course(course, user)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment