Skip to content

Commit

Permalink
feat: Added "Special" to data name
Browse files Browse the repository at this point in the history
- Specified that the events are only emitted when special exams go through edx-exams.
- Re-ordered params in data docstring
  • Loading branch information
ilee2u committed Sep 28, 2023
1 parent 683d586 commit 7e5cabd
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 18 deletions.
10 changes: 8 additions & 2 deletions openedx_events/learning/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
32 changes: 16 additions & 16 deletions openedx_events/learning/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
CohortData,
CourseDiscussionConfigurationData,
CourseEnrollmentData,
ExamAttemptData,
SpecialExamAttemptData,
PersistentCourseGradeData,
ProgramCertificateData,
UserData,
Expand Down Expand Up @@ -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,
}
)

0 comments on commit 7e5cabd

Please sign in to comment.