From da06079b5a9f2d7986e164d3b423b6c501ffac54 Mon Sep 17 00:00:00 2001 From: Bryann Valderrama <64033729+BryanttV@users.noreply.github.com> Date: Thu, 18 Apr 2024 14:39:06 -0500 Subject: [PATCH] refactor: update ora submission data (#341) --- CHANGELOG.rst | 8 ++++++ openedx_events/__init__.py | 2 +- openedx_events/learning/data.py | 45 +++++++++++++++++++++++---------- 3 files changed, 40 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index fb7471db..d816f445 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -14,6 +14,14 @@ Change Log Unreleased ---------- +[9.9.2] - 2024-04-18 +-------------------- + +Changed +~~~~~~~ + +* Updated ``ORASubmissionData`` class. + [9.9.1] - 2024-04-12 -------------------- diff --git a/openedx_events/__init__.py b/openedx_events/__init__.py index 7dc0578d..5c575d44 100644 --- a/openedx_events/__init__.py +++ b/openedx_events/__init__.py @@ -5,4 +5,4 @@ more information about the project. """ -__version__ = "9.9.1" +__version__ = "9.9.2" diff --git a/openedx_events/learning/data.py b/openedx_events/learning/data.py index 2aa03baf..43e7e0bf 100644 --- a/openedx_events/learning/data.py +++ b/openedx_events/learning/data.py @@ -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) @@ -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)