diff --git a/openedx_events/learning/data.py b/openedx_events/learning/data.py index e8c6bc2f..109c7928 100644 --- a/openedx_events/learning/data.py +++ b/openedx_events/learning/data.py @@ -487,3 +487,20 @@ 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 ORASubmissionData: + """ + Attributes defined to represent event when a user submits an ORA assignment. + + Arguments: + id (str): identifier of the ORA submission. + file_downloads (List[dict]): list of related files in the ORA submission. Each dict + contains the following keys: + * id (str): identifier of the file. + * url (str): url of the file. + """ + + id = attr.ib(type=str) + file_downloads = attr.ib(type=List[dict]) diff --git a/openedx_events/learning/signals.py b/openedx_events/learning/signals.py index ed36fab4..5dd55cd4 100644 --- a/openedx_events/learning/signals.py +++ b/openedx_events/learning/signals.py @@ -23,6 +23,7 @@ UserData, UserNotificationData, XBlockSkillVerificationData, + ORASubmissionData, ) from openedx_events.tooling import OpenEdxPublicSignal @@ -350,3 +351,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, + }, +)