Commit 4892897c by Chris Dodge

add depth parameters when loading course and student-state caches. This will…

add depth parameters when loading course and student-state caches. This will make fewer (but fatter) queries to the database
parent 999ed17e
...@@ -270,7 +270,7 @@ def progress_summary(student, request, course, student_module_cache): ...@@ -270,7 +270,7 @@ def progress_summary(student, request, course, student_module_cache):
# would be simpler # would be simpler
course_module = get_module(student, request, course_module = get_module(student, request,
course.location, student_module_cache, course.location, student_module_cache,
course.id) course.id, depth=None)
if not course_module: if not course_module:
# This student must not have access to the course. # This student must not have access to the course.
return None return None
......
...@@ -570,7 +570,7 @@ def progress(request, course_id, student_id=None): ...@@ -570,7 +570,7 @@ def progress(request, course_id, student_id=None):
Course staff are allowed to see the progress of students in their class. Course staff are allowed to see the progress of students in their class.
""" """
course = get_course_with_access(request.user, course_id, 'load') course = get_course_with_access(request.user, course_id, 'load', depth=None)
staff_access = has_access(request.user, course, 'staff') staff_access = has_access(request.user, course, 'staff')
if student_id is None or student_id == request.user.id: if student_id is None or student_id == request.user.id:
...@@ -590,7 +590,7 @@ def progress(request, course_id, student_id=None): ...@@ -590,7 +590,7 @@ def progress(request, course_id, student_id=None):
student = User.objects.prefetch_related("groups").get(id=student.id) student = User.objects.prefetch_related("groups").get(id=student.id)
student_module_cache = StudentModuleCache.cache_for_descriptor_descendents( student_module_cache = StudentModuleCache.cache_for_descriptor_descendents(
course_id, student, course) course_id, student, course, depth=None)
courseware_summary = grades.progress_summary(student, request, course, courseware_summary = grades.progress_summary(student, request, course,
student_module_cache) student_module_cache)
......
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