Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TN-2747 look for indefinite QNR in both v3 and v5. #4426

Merged
merged 1 commit into from
Dec 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions portal/models/questionnaire_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -910,11 +910,16 @@ def qnr_document_id(
QuestionnaireResponse.subject_id == subject_id).filter(
QuestionnaireResponse.document[
('questionnaire', 'reference')
].astext.endswith(questionnaire_name)).filter(
QuestionnaireResponse.questionnaire_bank_id ==
questionnaire_bank_id).with_entities(
].astext.endswith(questionnaire_name)).with_entities(
QuestionnaireResponse.document[(
'identifier', 'value')])
if questionnaire_name != 'irondemog_v3':
# Another special indefinite workaround. irondemog_v3 happens to live
# in multiple questionnaire banks, thus the lookup will fail when
# restricted by QB.id, should the org have transitioned since the user
# left work incomplete from the previous protocol (TN-2747)
qnr = qnr.filter(QuestionnaireResponse.questionnaire_bank_id == questionnaire_bank_id)

if iteration is not None:
qnr = qnr.filter(QuestionnaireResponse.qb_iteration == iteration)
else:
Expand Down
Loading