Skip to content

Commit

Permalink
fix bug when supplementalDetails is empty if qpath is not present
Browse files Browse the repository at this point in the history
  • Loading branch information
noliveleger committed Sep 19, 2024
1 parent fd6e61a commit 39ccb8d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion kobo/apps/subsequences/api_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def get_submission_processing(asset, s_uuid):
try:
submission_extra = asset.submission_extras.get(submission_uuid=s_uuid)

# TODO delete two lines below when every asset is repopulated with
# TODO delete "if" statement below when every asset is repopulated with
# `xpath` instead of `qpath`.
if content := get_sanitized_dict_keys(
submission_extra.content, asset
Expand Down
11 changes: 9 additions & 2 deletions kobo/apps/subsequences/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,14 @@ def stream_with_extras(submission_stream, asset):
val_expanded = val_expanded[0]
qual_response['val'] = val_expanded
qual_response.update(qual_q)
submission[SUPPLEMENTAL_DETAILS_KEY] = get_sanitized_dict_keys(

# Remove `qpath` if present
if sanitized_suppl_details := get_sanitized_dict_keys(
all_supplemental_details, asset
)
):
all_supplemental_details = sanitized_suppl_details

submission[SUPPLEMENTAL_DETAILS_KEY] = all_supplemental_details


yield submission

0 comments on commit 39ccb8d

Please sign in to comment.