From 04439a321791ef58a8e2627a185ea8fc91775c3f Mon Sep 17 00:00:00 2001 From: David Ormsbee Date: Fri, 31 Aug 2012 15:20:13 -0400 Subject: [PATCH] add comments explaining prefetch need --- lms/djangoapps/courseware/views.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lms/djangoapps/courseware/views.py b/lms/djangoapps/courseware/views.py index dab04a0957..6b77792203 100644 --- a/lms/djangoapps/courseware/views.py +++ b/lms/djangoapps/courseware/views.py @@ -327,6 +327,9 @@ def progress(request, course_id, student_id=None): # NOTE: To make sure impersonation by instructor works, use # student instead of request.user in the rest of the function. + + # The pre-fetching of groups is done to make auth checks not require an + # additional DB lookup (this kills the Progress page in particular). student = User.objects.prefetch_related("groups").get(id=student.id) student_module_cache = StudentModuleCache.cache_for_descriptor_descendents(