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
3cbc5b9cdc/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 :

3cbc5b9cdc/lms/djangoapps/instructor/views/instructor_dashboard.py (L585)

Which eventually call the method **get_units_with_due_date**

3cbc5b9cdc/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.
This commit is contained in:
jfavellar90
2021-05-25 14:42:20 -05:00
committed by David Ormsbee
parent f3f604c25f
commit aefdda9df3

View File

@@ -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,