From d6e5e98aa5dd9b3fe2bb2ecc038638ba61bd09a9 Mon Sep 17 00:00:00 2001 From: RuthShryock Date: Fri, 26 Jul 2024 14:05:10 -0400 Subject: [PATCH] revise fix for duplicate submission uuids to instead use deepcopy so that uuids are not directly mutated --- kobo/apps/subsequences/tests/test_submission_stream.py | 2 +- kobo/apps/subsequences/utils/__init__.py | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/kobo/apps/subsequences/tests/test_submission_stream.py b/kobo/apps/subsequences/tests/test_submission_stream.py index 1becdb3751..a31021506b 100644 --- a/kobo/apps/subsequences/tests/test_submission_stream.py +++ b/kobo/apps/subsequences/tests/test_submission_stream.py @@ -262,7 +262,7 @@ def test_stream_with_extras_handles_duplicated_submission_uuids(self): # Process submissions with extras try: - output = list( + _ = list( stream_with_extras( self.asset.deployment.get_submissions( user=self.asset.owner diff --git a/kobo/apps/subsequences/utils/__init__.py b/kobo/apps/subsequences/utils/__init__.py index ec56798435..bddf773004 100644 --- a/kobo/apps/subsequences/utils/__init__.py +++ b/kobo/apps/subsequences/utils/__init__.py @@ -150,7 +150,7 @@ def stream_with_extras(submission_stream, asset): uuid = submission[SUBMISSION_UUID_FIELD] else: uuid = submission['_uuid'] - all_supplemental_details = extras.get(uuid, {}) + all_supplemental_details = deepcopy(extras.get(uuid, {})) for qpath, supplemental_details in all_supplemental_details.items(): try: all_qual_responses = supplemental_details['qual'] @@ -176,8 +176,6 @@ def stream_with_extras(submission_stream, asset): val = [val] val_expanded = [] for v in val: - if isinstance(v, dict): - v = v['uuid'] try: v_ex = qual_choices_per_question_by_uuid[ qual_q['uuid']