Skip to content

Commit

Permalink
Moving response status check out of get_qualtrics_response
Browse files Browse the repository at this point in the history
  • Loading branch information
nathan-moore-97 committed Oct 11, 2023
1 parent cd9f42d commit 83a8dbc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
7 changes: 6 additions & 1 deletion gdrive/export_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ async def survey_upload_response_task(request):

log.info("Response found, beginning export.")

if response["status"] != "Complete":
raise error.ExportError(
f"Cannot upload incomplete survery response to raw completions spreadsheet: {request.responseId}"
)

# By the time we get here, we can count on the response containing the demographic data
# as it is included in the Completed flow responses. Responses without complete status
# throws exception in get_qualtrics_response
Expand Down Expand Up @@ -117,7 +122,7 @@ class FindModel(BaseModel):
responseId: str
field: str
values: list[str]
result_field: str | None
result_field: str | None = None


@router.post("/find")
Expand Down
9 changes: 1 addition & 8 deletions gdrive/export_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,4 @@ def get_qualtrics_response(surveyId: str, responseId: str):
f"No survey response found for responseId: {responseId}"
)

resp = r.json()

if resp["status"] != "Complete":
raise error.ExportError(
f"Cannot upload incomplete survery response to raw completions spreadsheet: {responseId}"
)

return resp
return r.json()

0 comments on commit 83a8dbc

Please sign in to comment.