From 3bbb71266bee129c53826f7876b7a62ec9e86b3f Mon Sep 17 00:00:00 2001 From: Bryann Valderrama Date: Thu, 18 Apr 2024 09:22:08 -0500 Subject: [PATCH] refactor: update ora submission data --- openedx_events/learning/data.py | 43 ++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 4 deletions(-) diff --git a/openedx_events/learning/data.py b/openedx_events/learning/data.py index 2aa03baf..dc21bcfc 100644 --- a/openedx_events/learning/data.py +++ b/openedx_events/learning/data.py @@ -464,15 +464,50 @@ class ORAFileDownloadsData: size = attr.ib(type=int) +@attr.s(frozen=True) +class ORASubmissionAnswer: + """ + Attributes defined to represent the answer submitted by the user in an ORA submission. + + Arguments: + 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. + """ + + 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) 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)