diff --git a/CHANGELOG.rst b/CHANGELOG.rst index a1762b32..4d72b1dd 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -14,8 +14,14 @@ Change Log Unreleased ---------- -[9.8.0] - 2024-04-11 +[9.9.0] - 2024-04-11 +-------------------- +Added +~~~~~~~ +* Added new ``ORA_SUBMISSION_CREATED`` event in learning. +[9.8.0] - 2024-04-11 +-------------------- Added ~~~~~ * Added support for Python 3.11 diff --git a/openedx_events/__init__.py b/openedx_events/__init__.py index 1b77b947..3ff978c8 100644 --- a/openedx_events/__init__.py +++ b/openedx_events/__init__.py @@ -5,4 +5,4 @@ more information about the project. """ -__version__ = "9.8.0" +__version__ = "9.9.0" diff --git a/openedx_events/learning/data.py b/openedx_events/learning/data.py index c9659ff3..2aa03baf 100644 --- a/openedx_events/learning/data.py +++ b/openedx_events/learning/data.py @@ -444,3 +444,35 @@ class CourseNotificationData: content_url = attr.ib(type=str) content_context = attr.ib(type=dict, factory=dict) audience_filters = attr.ib(type=dict, factory=dict) + + +@attr.s(frozen=True) +class ORAFileDownloadsData: + """ + Attributes defined to represent file downloads in an ORA submission. + + Arguments: + download_url (str): URL to download the file. + description (str): Description of the file. + name (str): Name of the file. + size (int): Size of the file. + """ + + download_url = attr.ib(type=str) + description = attr.ib(type=str) + name = attr.ib(type=str) + size = attr.ib(type=int) + + +@attr.s(frozen=True) +class ORASubmissionData: + """ + Attributes defined to represent event when a user submits an ORA assignment. + + Arguments: + id (str): identifier of the ORA submission. + file_downloads (List[ORAFileDownloadsData]): list of related files in the ORA submission. + """ + + id = attr.ib(type=str) + file_downloads = attr.ib(type=List[ORAFileDownloadsData], factory=list) diff --git a/openedx_events/learning/signals.py b/openedx_events/learning/signals.py index 48898581..9459d891 100644 --- a/openedx_events/learning/signals.py +++ b/openedx_events/learning/signals.py @@ -17,6 +17,7 @@ CourseNotificationData, DiscussionThreadData, ExamAttemptData, + ORASubmissionData, PersistentCourseGradeData, ProgramCertificateData, UserData, @@ -336,3 +337,16 @@ "course_notification_data": CourseNotificationData, } ) + + +# .. event_type: org.openedx.learning.ora.submission.created.v1 +# .. event_name: ORA_SUBMISSION_CREATED +# .. event_description: Emitted when a new ORA submission is created +# .. event_data: ORASubmissionData +# Warning: This event is currently incompatible with the event bus, list/dict cannot be serialized yet +ORA_SUBMISSION_CREATED = OpenEdxPublicSignal( + event_type="org.openedx.learning.ora.submission.created.v1", + data={ + "submission": ORASubmissionData, + }, +) diff --git a/openedx_events/tooling.py b/openedx_events/tooling.py index 2a5b2853..1ca53306 100644 --- a/openedx_events/tooling.py +++ b/openedx_events/tooling.py @@ -28,6 +28,7 @@ "org.openedx.learning.response.created.v1", "org.openedx.learning.comment.created.v1", "org.openedx.learning.course.notification.requested.v1", + "org.openedx.learning.ora.submission.created.v1", ] SIGNAL_PROCESSED_FROM_EVENT_BUS = "from_event_bus"