Initial Attempt at adding proctored exam settings

Added proctored settings card, however the page doesn't get the legacy link correctly
This commit is contained in:
mohtamba
2021-08-11 08:34:46 -04:00
parent 3a87aad963
commit 9b7d92fe45
2 changed files with 50 additions and 0 deletions

View File

@@ -1,4 +1,5 @@
"""Course app config for courseware apps."""
from cms.djangoapps.contentstore.utils import get_proctored_exam_settings_url
from typing import Dict, Optional
from django import urls
@@ -161,3 +162,51 @@ class CalculatorCourseApp(CourseApp):
# There is nothing to configure for calculator yet.
"configure": False,
}
class ProctoringCourseApp(CourseApp):
"""
Course App config for proctoring app.
"""
app_id = "proctoring"
name = _("Proctoring")
description = _("Maintain exam integrity by enabling a proctoring solution for your course")
@classmethod
def is_available(cls, course_key: CourseKey) -> bool:
"""
Proctoring is available for all courses.
"""
return True
@classmethod
def is_enabled(cls, course_key: CourseKey) -> bool:
"""
Get calculator enabled status from course overview model.
"""
return CourseOverview.get_from_id(course_key).enable_proctored_exams
@classmethod
def set_enabled(cls, course_key: CourseKey, enabled: bool, user: 'User') -> bool:
"""
Update calculator enabled status in modulestore.
"""
course = get_course_by_id(course_key)
course.enable_proctored_exams = enabled
modulestore().update_item(course, user.id)
return enabled
@classmethod
def get_allowed_operations(cls, course_key: CourseKey, user: Optional[User] = None) -> Dict[str, bool]:
"""
Get allowed operations for calculator app.
"""
return {
"enable": True,
# There is nothing to configure for calculator yet.
"configure": False,
}
@staticmethod
def legacy_link(course_key: CourseKey):
return get_proctored_exam_settings_url(course_key)

View File

@@ -42,6 +42,7 @@ setup(
"calculator = lms.djangoapps.courseware.plugins:CalculatorCourseApp",
"discussion = openedx.core.djangoapps.discussions.plugins:DiscussionCourseApp",
"edxnotes = lms.djangoapps.edxnotes.plugins:EdxNotesCourseApp",
"proctoring = lms.djangoapps.courseware.plugins:ProctoringCourseApp",
"progress = lms.djangoapps.courseware.plugins:ProgressCourseApp",
"teams = lms.djangoapps.teams.plugins:TeamsCourseApp",
"textbooks = lms.djangoapps.courseware.plugins:TextbooksCourseApp",