From e0e9c0cc535d0b5cce98486ff84d67354c8c41b9 Mon Sep 17 00:00:00 2001 From: Bryann Valderrama Date: Mon, 5 Feb 2024 11:18:55 -0500 Subject: [PATCH] feat: add ora submission created event --- openedx_events/learning/data.py | 19 +++++++++++++++++++ openedx_events/learning/signals.py | 14 ++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/openedx_events/learning/data.py b/openedx_events/learning/data.py index e8c6bc2f..af0a4203 100644 --- a/openedx_events/learning/data.py +++ b/openedx_events/learning/data.py @@ -487,3 +487,22 @@ 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: + * 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. + """ + + 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, + }, +)