Commit ee65c878 by Waheed Ahmed

Use CourseOverview instead of modulestore.

parent 5d6362f3
......@@ -6,7 +6,8 @@ from django.dispatch.dispatcher import receiver
from certificates.models import CertificateGenerationCourseSetting
from opaque_keys.edx.keys import CourseKey
from xmodule.modulestore.django import SignalHandler, modulestore
from openedx.core.djangoapps.content.course_overviews.models import CourseOverview
from xmodule.modulestore.django import SignalHandler
@receiver(SignalHandler.course_published)
......@@ -22,7 +23,7 @@ def _listen_for_course_publish(sender, course_key, **kwargs): # pylint: disable
def enable_self_generated_certs(course_key):
"""Enable the self-generated certificates by default for self-paced courses."""
course_key = CourseKey.from_string(course_key)
course = modulestore().get_course(course_key)
course = CourseOverview.get_from_id(course_key)
is_enabled_for_course = CertificateGenerationCourseSetting.is_enabled_for_course(course_key)
if course.self_paced and not is_enabled_for_course:
CertificateGenerationCourseSetting.set_enabled_for_course(course_key, True)
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