Commit 18822bdb by John Eskew Committed by Don Mitchell

Wrap course info and dashboard in bulk ops wrapper to reduce Mongo calls.

parent 0ed4ee32
...@@ -246,7 +246,9 @@ def get_course_enrollment_pairs(user, course_org_filter, org_filter_out_set): ...@@ -246,7 +246,9 @@ def get_course_enrollment_pairs(user, course_org_filter, org_filter_out_set):
a student's dashboard. a student's dashboard.
""" """
for enrollment in CourseEnrollment.enrollments_for_user(user): for enrollment in CourseEnrollment.enrollments_for_user(user):
course = modulestore().get_course(enrollment.course_id) store = modulestore()
with store.bulk_operations(enrollment.course_id):
course = store.get_course(enrollment.course_id)
if course and not isinstance(course, ErrorDescriptor): if course and not isinstance(course, ErrorDescriptor):
# if we are in a Microsite, then filter out anything that is not # if we are in a Microsite, then filter out anything that is not
......
...@@ -559,6 +559,7 @@ def course_info(request, course_id): ...@@ -559,6 +559,7 @@ def course_info(request, course_id):
course_key = SlashSeparatedCourseKey.from_deprecated_string(course_id) course_key = SlashSeparatedCourseKey.from_deprecated_string(course_id)
with modulestore().bulk_operations(course_key):
course = get_course_with_access(request.user, 'load', course_key) course = get_course_with_access(request.user, 'load', course_key)
staff_access = has_access(request.user, 'staff', course) staff_access = has_access(request.user, 'staff', course)
masq = setup_masquerade(request, staff_access) # allow staff to toggle masquerade on info page masq = setup_masquerade(request, staff_access) # allow staff to toggle masquerade on info page
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment