|
24 | 24 | ProctoredExamReviewAlreadyExists, |
25 | 25 | ProctoredExamBadReviewStatus, |
26 | 26 | ) |
| 27 | +from edx_proctoring.runtime import get_runtime_service |
27 | 28 | from edx_proctoring.utils import locate_attempt_by_attempt_code, emit_event |
28 | 29 | from edx_proctoring. models import ( |
29 | 30 | ProctoredExamSoftwareSecureReview, |
@@ -64,6 +65,7 @@ def __init__(self, organization, exam_sponsor, exam_register_endpoint, |
64 | 65 | self.send_email = send_email |
65 | 66 | self.passing_review_status = ['Clean', 'Rules Violation'] |
66 | 67 | self.failing_review_status = ['Not Reviewed', 'Suspicious'] |
| 68 | + self.notify_support_for_status = ['Suspicious'] |
67 | 69 |
|
68 | 70 | def register_exam_attempt(self, exam, context): |
69 | 71 | """ |
@@ -261,6 +263,8 @@ def on_review_callback(self, payload): |
261 | 263 | exam = serialized_exam_object.data |
262 | 264 | emit_event(exam, 'review_received', attempt=attempt, override_data=data) |
263 | 265 |
|
| 266 | + self._create_zendesk_ticket(review, serialized_exam_object, serialized_attempt_obj) |
| 267 | + |
264 | 268 | def on_review_saved(self, review, allow_rejects=False): # pylint: disable=arguments-differ |
265 | 269 | """ |
266 | 270 | called when a review has been save - either through API (on_review_callback) or via Django Admin panel |
@@ -349,6 +353,20 @@ def _split_fullname(self, full_name): |
349 | 353 |
|
350 | 354 | return (first_name, last_name) |
351 | 355 |
|
| 356 | + def _create_zendesk_ticket(self, review, serialized_exam_object, serialized_attempt_obj): |
| 357 | + """ |
| 358 | + Creates a Zendesk ticket for reviews with status listed in self.notify_support_for_status |
| 359 | + """ |
| 360 | + if review.review_status in self.notify_support_for_status: |
| 361 | + instructor_service = get_runtime_service('instructor') |
| 362 | + if instructor_service: |
| 363 | + instructor_service.send_support_notification( |
| 364 | + course_id=serialized_exam_object["course_id"], |
| 365 | + exam_name=serialized_exam_object["exam_name"], |
| 366 | + student_username=serialized_attempt_obj["user"]["username"], |
| 367 | + review_status=review.review_status |
| 368 | + ) |
| 369 | + |
352 | 370 | def _get_payload(self, exam, context): |
353 | 371 | """ |
354 | 372 | Constructs the data payload that Software Secure expects |
|
0 commit comments