diff --git a/lms/djangoapps/courseware/toggles.py b/lms/djangoapps/courseware/toggles.py index 58d072263df719966e2cbf487919e8d35535ed1f..46ac561abde54c231f9d5495f72b664044b47e3a 100644 --- a/lms/djangoapps/courseware/toggles.py +++ b/lms/djangoapps/courseware/toggles.py @@ -100,6 +100,21 @@ COURSEWARE_PROCTORING_IMPROVEMENTS = CourseWaffleFlag( WAFFLE_FLAG_NAMESPACE, 'proctoring_improvements', __name__ ) +# .. toggle_name: courseware.exam_resume_proctoring_improvements +# .. toggle_implementation: CourseWaffleFlag +# .. toggle_default: False +# .. toggle_description: Waffle flag to toggle various exam resumption enhancements to the proctoring experience, +# including but not limited to the addition of a "Resume" action for exam attempts in the "error" state to the +# Student Special Exam Attempts panel of the Special Exams tab of the Instructor Dashboard, etc. +# .. toggle_use_cases: temporary +# .. toggle_creation_date: 2020-01-25 +# .. toggle_target_removal_date: None +# .. toggle_warnings: None +# .. toggle_tickets: MST-597 +EXAM_RESUME_PROCTORING_IMPROVEMENTS = CourseWaffleFlag( + WAFFLE_FLAG_NAMESPACE, 'exam_resume_proctoring_improvements', __name__ +) + def course_exit_page_is_active(course_key): return ( diff --git a/lms/djangoapps/instructor/tests/test_proctoring.py b/lms/djangoapps/instructor/tests/test_proctoring.py index 84b37612b500ccd6cc24cca3fe238ffeb25a16a0..41dc9c927221142d4b50943a350b9a8dc33f10bd 100644 --- a/lms/djangoapps/instructor/tests/test_proctoring.py +++ b/lms/djangoapps/instructor/tests/test_proctoring.py @@ -11,8 +11,10 @@ from six import text_type from edx_proctoring.api import create_exam from edx_proctoring.backends.tests.test_backend import TestBackendProvider +from edx_toggles.toggles.testutils import override_waffle_flag from common.djangoapps.student.roles import CourseInstructorRole, CourseStaffRole from common.djangoapps.student.tests.factories import AdminFactory +from lms.djangoapps.courseware.toggles import EXAM_RESUME_PROCTORING_IMPROVEMENTS from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory @@ -177,6 +179,32 @@ class TestProctoringDashboardViews(SharedModuleStoreTestCase): self.instructor.save() self._assert_escalation_email_available(True) + @override_waffle_flag(EXAM_RESUME_PROCTORING_IMPROVEMENTS, True) + def test_exam_resume_proctoring_improvements_toggle_enabled(self): + """ + The value of the feature toggle EXAM_RESUME_PROCTORING_IMPROVEMENTS should be included in the response + via the data-enable-exam-resume-proctoring-improvements data attribute when the toggle is enabled. + """ + self.setup_course(True, True) + self.instructor.is_staff = True + self.instructor.save() + + response = self.client.get(self.url) + self.assertIn('data-enable-exam-resume-proctoring-improvements="True"', response.content.decode('utf-8')) + + @override_waffle_flag(EXAM_RESUME_PROCTORING_IMPROVEMENTS, False) + def test_exam_resume_proctoring_improvements_toggle_disabled(self): + """ + The value of the feature toggle EXAM_RESUME_PROCTORING_IMPROVEMENTS should be included in the response + via the data-enable-exam-resume-proctoring-improvements data attribute when the toggle is disabled. + """ + self.setup_course(True, True) + self.instructor.is_staff = True + self.instructor.save() + + response = self.client.get(self.url) + self.assertIn('data-enable-exam-resume-proctoring-improvements="False"', response.content.decode('utf-8')) + def test_review_dashboard(self): """ The exam review dashboard will appear for backends that support the feature diff --git a/lms/djangoapps/instructor/views/instructor_dashboard.py b/lms/djangoapps/instructor/views/instructor_dashboard.py index 5e3ad50821a1271703780bd0484b15df1e227989..5c3266e78e2ad0c27cb28872d92f34a5df5b128c 100644 --- a/lms/djangoapps/instructor/views/instructor_dashboard.py +++ b/lms/djangoapps/instructor/views/instructor_dashboard.py @@ -44,6 +44,7 @@ from lms.djangoapps.certificates.models import ( from lms.djangoapps.courseware.access import has_access from lms.djangoapps.courseware.courses import get_course_by_id, get_studio_url from lms.djangoapps.courseware.module_render import get_module_by_usage_id +from lms.djangoapps.courseware.toggles import EXAM_RESUME_PROCTORING_IMPROVEMENTS from lms.djangoapps.discussion.django_comment_client.utils import available_division_schemes, has_forum_access from lms.djangoapps.grades.api import is_writable_gradebook_enabled from openedx.core.djangoapps.course_groups.cohorts import DEFAULT_COHORT_NAME, get_course_cohorts, is_course_cohorted @@ -276,6 +277,7 @@ def _section_special_exams(course, access): 'course_id': course_key, 'escalation_email': escalation_email, 'show_dashboard': is_backend_dashboard_available(course_key), + 'enable_exam_resume_proctoring_improvements': EXAM_RESUME_PROCTORING_IMPROVEMENTS.is_enabled(course.id), } return section_data diff --git a/lms/templates/instructor/instructor_dashboard_2/special_exams.html b/lms/templates/instructor/instructor_dashboard_2/special_exams.html index 298490c77bd78742d7c703589059bbe37f64cb65..5004a3a1052e1cfc73125a06350648b15c9baaa2 100644 --- a/lms/templates/instructor/instructor_dashboard_2/special_exams.html +++ b/lms/templates/instructor/instructor_dashboard_2/special_exams.html @@ -15,7 +15,7 @@ import pytz </div> <div class="wrap"> <h3 class="hd hd-3">${_('Student Special Exam Attempts')}</h3> - <div class="student-proctored-exam-container" data-course-id="${ section_data['course_id'] }"></div> + <div class="student-proctored-exam-container" data-course-id="${ section_data['course_id'] }" data-enable-exam-resume-proctoring-improvements="${ section_data['enable_exam_resume_proctoring_improvements'] }"></div> </div> % if section_data['show_dashboard']: <div class="wrap">