From aefdda9df372ef94fab96b8102fc115cc95bfc82 Mon Sep 17 00:00:00 2001 From: jfavellar90 Date: Tue, 25 May 2021 14:42:20 -0500 Subject: [PATCH] perf: Relax load in instructor dashboard page Relax load when bringing all the course children when fetching a course in the instructor dashboard page. When loading the Instructor dashboard, the course is fetched with https://github.com/edx/edx-platform/blob/3cbc5b9cdcbebb74b6f03957fcc7eb3749846add/lms/djangoapps/instructor/views/instructor_dashboard.py#L122 Please note that the parameter **depth** is zero, so the course is fetched with no children (sections, subsections, sequentials, etc). In a subsequent part of the code, the extensions tab is loaded, specifically in : https://github.com/edx/edx-platform/blob/3cbc5b9cdcbebb74b6f03957fcc7eb3749846add/lms/djangoapps/instructor/views/instructor_dashboard.py#L585 Which eventually call the method **get_units_with_due_date** https://github.com/edx/edx-platform/blob/3cbc5b9cdcbebb74b6f03957fcc7eb3749846add/lms/djangoapps/instructor/views/tools.py#L121 . This method iterates over the course and its children to find blocks with due dates. This iteration was taking too long unless the course is fetched with **depth** None, which brings all the children of the course, reason why this commit is created. --- lms/djangoapps/instructor/views/instructor_dashboard.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lms/djangoapps/instructor/views/instructor_dashboard.py b/lms/djangoapps/instructor/views/instructor_dashboard.py index 2a6f315d68..ffc2a752d9 100644 --- a/lms/djangoapps/instructor/views/instructor_dashboard.py +++ b/lms/djangoapps/instructor/views/instructor_dashboard.py @@ -119,7 +119,7 @@ def instructor_dashboard_2(request, course_id): # lint-amnesty, pylint: disable log.error("Unable to find course with course key %s while loading the Instructor Dashboard.", course_id) return HttpResponseServerError() - course = get_course_by_id(course_key, depth=0) + course = get_course_by_id(course_key, depth=None) access = { 'admin': request.user.is_staff,