Skip to content

Commit

Permalink
refactor: update ora submission data (#341)
Browse files Browse the repository at this point in the history
  • Loading branch information
BryanttV committed Apr 18, 2024
1 parent 6d94857 commit da06079
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 15 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ Change Log
Unreleased
----------

[9.9.2] - 2024-04-18
--------------------

Changed
~~~~~~~

* Updated ``ORASubmissionData`` class.

[9.9.1] - 2024-04-12
--------------------

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.9.1"
__version__ = "9.9.2"
45 changes: 31 additions & 14 deletions openedx_events/learning/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,21 +447,28 @@ class CourseNotificationData:


@attr.s(frozen=True)
class ORAFileDownloadsData:
class ORASubmissionAnswer:
"""
Attributes defined to represent file downloads in an ORA submission.
Attributes defined to represent the answer submitted by the user 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.
parts (List[dict]): List with the response text in the ORA submission.
The following attributes are used to represent the files submitted in the ORA submission:
file_keys (List[str]): List of file keys in the ORA submission.
file_descriptions (List[str]): List of file descriptions in the ORA submission.
file_names (List[str]): List of file names in the ORA submission.
file_sizes (List[int]): List of file sizes in the ORA submission.
file_urls (List[str]): List of file URLs in the ORA submission.
"""

download_url = attr.ib(type=str)
description = attr.ib(type=str)
name = attr.ib(type=str)
size = attr.ib(type=int)
parts = attr.ib(type=List[dict], factory=list)
file_keys = attr.ib(type=List[str], factory=list)
file_descriptions = attr.ib(type=List[str], factory=list)
file_names = attr.ib(type=List[str], factory=list)
file_sizes = attr.ib(type=List[int], factory=list)
file_urls = attr.ib(type=List[str], factory=list)


@attr.s(frozen=True)
Expand All @@ -470,9 +477,19 @@ 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.
uuid (str): The UUID of the ORA submission.
anonymous_user_id (str): Optional. Anonymous user ID of the user who submitted the ORA submission.
location (str): Optional. Location of the ORA submission.
attempt_number (int): Attempt number of the ORA submission.
created_at (datetime): Date and time when the ORA submission was created.
submitted_at (datetime): Date and time when the ORA submission was submitted.
answer (ORASubmissionAnswer): Answer submitted by the user in the ORA submission.
"""

id = attr.ib(type=str)
file_downloads = attr.ib(type=List[ORAFileDownloadsData], factory=list)
uuid = attr.ib(type=str)
anonymous_user_id = attr.ib(type=str)
location = attr.ib(type=str)
attempt_number = attr.ib(type=int)
created_at = attr.ib(type=datetime)
submitted_at = attr.ib(type=datetime)
answer = attr.ib(type=ORASubmissionAnswer)

0 comments on commit da06079

Please sign in to comment.