Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: update ora submission data #341

Merged
merged 3 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)