Skip to content

Commit

Permalink
feat: add ora submission created event (#335)
Browse files Browse the repository at this point in the history
  • Loading branch information
BryanttV authored Apr 11, 2024
1 parent 9fe0ae9 commit c0edbd3
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 2 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion openedx_events/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
more information about the project.
"""

__version__ = "9.8.0"
__version__ = "9.9.0"
32 changes: 32 additions & 0 deletions openedx_events/learning/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
14 changes: 14 additions & 0 deletions openedx_events/learning/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
CourseNotificationData,
DiscussionThreadData,
ExamAttemptData,
ORASubmissionData,
PersistentCourseGradeData,
ProgramCertificateData,
UserData,
Expand Down Expand Up @@ -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,
},
)
1 change: 1 addition & 0 deletions openedx_events/tooling.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit c0edbd3

Please sign in to comment.