From 7e5cabda67de099b300dcf5cc5e8530191805635 Mon Sep 17 00:00:00 2001 From: ilee2u Date: Thu, 28 Sep 2023 15:26:53 -0400 Subject: [PATCH] feat: Added "Special" to data name - Specified that the events are only emitted when special exams go through edx-exams. - Re-ordered params in data docstring --- openedx_events/learning/data.py | 10 ++++++++-- openedx_events/learning/signals.py | 32 +++++++++++++++--------------- 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/openedx_events/learning/data.py b/openedx_events/learning/data.py index 849816a0..3edd3c45 100644 --- a/openedx_events/learning/data.py +++ b/openedx_events/learning/data.py @@ -299,16 +299,22 @@ class ProgramCertificateData: @attr.s(frozen=True) -class ExamAttemptData: +class SpecialExamAttemptData: """ Attributes defined for the Open edX Exam downstream effects. + Note that events that use this data type: + A. Pretain to "Special Exams", e.g. Timed or Proctored exams, and not non-timed course + subsections that are labelled as an exam. + B. Are only ever emitted from the newer exams backend, edx-exams, and never from the + legacy exams backend, edx-proctoring. + Arguments: student_user (UserData): user object for the student to whom the exam attempt belongs course_key (CourseKey): identifier of the course to which the exam attempt belongs usage_key (UsageKey): identifier of the content that will get a exam attempt - requesting_user (UserData): user triggering the event (sometimes a non-learner, e.g. an instructor) exam_type (str): type of exam that was taken (e.g. timed, proctored, etc.) + requesting_user (UserData): user triggering the event (sometimes a non-learner, e.g. an instructor) """ student_user = attr.ib(type=UserData) diff --git a/openedx_events/learning/signals.py b/openedx_events/learning/signals.py index 6ce99a56..afadb690 100644 --- a/openedx_events/learning/signals.py +++ b/openedx_events/learning/signals.py @@ -13,7 +13,7 @@ CohortData, CourseDiscussionConfigurationData, CourseEnrollmentData, - ExamAttemptData, + SpecialExamAttemptData, PersistentCourseGradeData, ProgramCertificateData, UserData, @@ -200,55 +200,55 @@ # .. event_type: org.openedx.learning.exam.attempt.submitted.v1 # .. event_name: EXAM_ATTEMPT_SUBMITTED -# .. event_description: Emitted when an exam attempt is submitted by a learner. -# .. event_data: ExamAttemptData +# .. event_description: Emitted when an exam attempt is submitted by a learner in edx-exams. +# .. event_data: SpecialExamAttemptData EXAM_ATTEMPT_SUBMITTED = OpenEdxPublicSignal( event_type="org.openedx.learning.exam.attempt.submitted.v1", data={ - "exam_attempt": ExamAttemptData, + "exam_attempt": SpecialExamAttemptData, } ) # .. event_type: org.openedx.learning.exam.attempt.rejected.v1 # .. event_name: EXAM_ATTEMPT_REJECTED -# .. event_description: Emitted when an exam attempt is marked rejected. -# .. event_data: ExamAttemptData +# .. event_description: Emitted when an exam attempt is marked rejected in edx-exams. +# .. event_data: SpecialExamAttemptData EXAM_ATTEMPT_REJECTED = OpenEdxPublicSignal( event_type="org.openedx.learning.exam.attempt.rejected.v1", data={ - "exam_attempt": ExamAttemptData, + "exam_attempt": SpecialExamAttemptData, } ) # .. event_type: org.openedx.learning.exam.attempt.verified.v1 # .. event_name: EXAM_ATTEMPT_VERIFIED -# .. event_description: Emitted when an exam attempt is marked verified. -# .. event_data: ExamAttemptData +# .. event_description: Emitted when an exam attempt is marked verified in edx-exams. +# .. event_data: SpecialExamAttemptData EXAM_ATTEMPT_VERIFIED = OpenEdxPublicSignal( event_type="org.openedx.learning.exam.attempt.verified.v1", data={ - "exam_attempt": ExamAttemptData, + "exam_attempt": SpecialExamAttemptData, } ) # .. event_type: org.openedx.learning.exam.attempt.errored.v1 # .. event_name: EXAM_ATTEMPT_ERRORED -# .. event_description: Emitted when a learner's exam attempt errors out. -# .. event_data: ExamAttemptData +# .. event_description: Emitted when a learner's exam attempt errors out in edx-exams. +# .. event_data: SpecialExamAttemptData EXAM_ATTEMPT_ERRORED = OpenEdxPublicSignal( event_type="org.openedx.learning.exam.attempt.errored.v1", data={ - "exam_attempt": ExamAttemptData, + "exam_attempt": SpecialExamAttemptData, } ) # .. event_type: org.openedx.learning.exam.attempt.reset.v1 # .. event_name: EXAM_ATTEMPT_RESET -# .. event_description: Emitted when an exam attempt is reset. -# .. event_data: ExamAttemptData +# .. event_description: Emitted when an exam attempt is reset in edx-exams. +# .. event_data: SpecialExamAttemptData EXAM_ATTEMPT_RESET = OpenEdxPublicSignal( event_type="org.openedx.learning.exam.attempt.reset.v1", data={ - "exam_attempt": ExamAttemptData, + "exam_attempt": SpecialExamAttemptData, } )