Skip to content
Snippets Groups Projects
Commit 3e673f59 authored by David Ormsbee's avatar David Ormsbee
Browse files

perf: Remove Modulestore call from Credit Service.

We can get the same information much more cheaply and predictably
by using CourseOverviews. This was contributing to slow traces for
the edx_proctoring.views:StudentOnboardingStatusView.get
transaction.
parent 874242a1
No related branches found
No related tags found
No related merge requests found
""" """
Implementation of "credit" XBlock service Implementation of "credit" XBlock service
""" """
import logging import logging
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
...@@ -10,7 +8,8 @@ from django.core.exceptions import ObjectDoesNotExist ...@@ -10,7 +8,8 @@ from django.core.exceptions import ObjectDoesNotExist
from opaque_keys.edx.keys import CourseKey from opaque_keys.edx.keys import CourseKey
from common.djangoapps.student.models import CourseEnrollment from common.djangoapps.student.models import CourseEnrollment
from xmodule.modulestore.django import modulestore from openedx.core.djangoapps.content.course_overviews.models import CourseOverview
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
...@@ -101,10 +100,10 @@ class CreditService: ...@@ -101,10 +100,10 @@ class CreditService:
} }
if return_course_info: if return_course_info:
course = modulestore().get_course(course_key, depth=0) course_overview = CourseOverview.get_from_id(course_key)
result.update({ result.update({
'course_name': course.display_name, 'course_name': course_overview.display_name,
'course_end_date': course.end, 'course_end_date': course_overview.end_date,
}) })
return result return result
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment