feat: sync with exam service on course publish (#31015)

Call into the exam service instead of the edx-proctoring plugin on course publish if the course_apps.exams_ida course waffle flag is enabled. This is an early step in moving away from edx-proctoring
This commit is contained in:
Zachary Hancock
2022-09-20 12:38:32 -04:00
committed by GitHub
parent 17b03388f5
commit 2f3c93ed9f
10 changed files with 366 additions and 3 deletions

View File

@@ -51,6 +51,7 @@ from common.djangoapps.course_action_state.models import CourseRerunState
from common.djangoapps.student.auth import has_course_author_access
from common.djangoapps.util.monitoring import monitor_import_failure
from openedx.core.djangoapps.content.learning_sequences.api import key_supports_outlines
from openedx.core.djangoapps.course_apps.toggles import exams_ida_enabled
from openedx.core.djangoapps.discussions.tasks import update_unit_discussion_state_from_discussion_blocks
from openedx.core.djangoapps.embargo.models import CountryAccessRule, RestrictedCourse
from openedx.core.lib.extract_tar import safetar_extractall
@@ -242,13 +243,17 @@ def update_special_exams_and_publish(course_key_str):
on_course_publish expects that the edx-proctoring subsystem has been refreshed
before being executed, so both functions are called here synchronously.
"""
from cms.djangoapps.contentstore.proctoring import register_special_exams
from cms.djangoapps.contentstore.exams import register_exams
from cms.djangoapps.contentstore.proctoring import register_special_exams as register_exams_legacy
from openedx.core.djangoapps.credit.signals import on_course_publish
course_key = CourseKey.from_string(course_key_str)
LOGGER.info('Attempting to register exams for course %s', course_key_str)
# Call the appropriate handler for either the exams IDA or the edx-proctoring plugin
register_exams_handler = register_exams if exams_ida_enabled(course_key) else register_exams_legacy
try:
register_special_exams(course_key)
register_exams_handler(course_key)
LOGGER.info('Successfully registered exams for course %s', course_key_str)
# pylint: disable=broad-except
except Exception as exception: