From 01a6a8156e396e75274a592feae4a2b48fd14653 Mon Sep 17 00:00:00 2001 From: kghoreshi Date: Tue, 12 Jul 2022 15:56:30 -0400 Subject: [PATCH 1/3] temp fix for id match --- src/components/QuestionnaireForm/QuestionnaireForm.jsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/QuestionnaireForm/QuestionnaireForm.jsx b/src/components/QuestionnaireForm/QuestionnaireForm.jsx index 29ae98be..f13a3a7e 100644 --- a/src/components/QuestionnaireForm/QuestionnaireForm.jsx +++ b/src/components/QuestionnaireForm/QuestionnaireForm.jsx @@ -184,7 +184,8 @@ export default class QuestionnaireForm extends Component { // search for any QuestionnaireResponses this.smart.request(this.getRetrieveSaveQuestionnaireUrl() + "&subject=" + this.getPatient()).then((result) => { - + console.log("hello") + console.log(result); this.popupClear("Would you like to load a previous form?", "Cancel", false); this.processSavedQuestionnaireResponses(result, true); }, ((result) => { @@ -236,7 +237,7 @@ export default class QuestionnaireForm extends Component { let count = 0; partialResponses.entry.forEach(r => { - if (this.props.qform.id == r.resource.questionnaire) { + if (r.resource.questionnaire.includes(this.props.qform.id)) { count = count + 1; // add the option to the popupOptions let date = new Date(r.resource.authored); From afdad232ced0a92a59d75bedcd8ed9e0e19427c6 Mon Sep 17 00:00:00 2001 From: kghoreshi Date: Tue, 12 Jul 2022 15:58:22 -0400 Subject: [PATCH 2/3] remove console log --- src/components/QuestionnaireForm/QuestionnaireForm.jsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/components/QuestionnaireForm/QuestionnaireForm.jsx b/src/components/QuestionnaireForm/QuestionnaireForm.jsx index f13a3a7e..e548196a 100644 --- a/src/components/QuestionnaireForm/QuestionnaireForm.jsx +++ b/src/components/QuestionnaireForm/QuestionnaireForm.jsx @@ -184,8 +184,6 @@ export default class QuestionnaireForm extends Component { // search for any QuestionnaireResponses this.smart.request(this.getRetrieveSaveQuestionnaireUrl() + "&subject=" + this.getPatient()).then((result) => { - console.log("hello") - console.log(result); this.popupClear("Would you like to load a previous form?", "Cancel", false); this.processSavedQuestionnaireResponses(result, true); }, ((result) => { From ffb5e72e3606aefd16d4fc6fcbfbea9f7ad6f960 Mon Sep 17 00:00:00 2001 From: kghoreshi Date: Tue, 12 Jul 2022 16:17:50 -0400 Subject: [PATCH 3/3] fix relaunch error --- .../QuestionnaireForm/QuestionnaireForm.jsx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/components/QuestionnaireForm/QuestionnaireForm.jsx b/src/components/QuestionnaireForm/QuestionnaireForm.jsx index e548196a..13109a05 100644 --- a/src/components/QuestionnaireForm/QuestionnaireForm.jsx +++ b/src/components/QuestionnaireForm/QuestionnaireForm.jsx @@ -1452,12 +1452,15 @@ export default class QuestionnaireForm extends Component { const savedParentItem = findSavedParentItem(parentLinkId, savedItem); const replaceOrInsertItem = (newResponseItem, savedParentItem) => { - const replaceIndex = savedParentItem.item.findIndex(item => item.linkId == newResponseItem.linkId); - if (replaceIndex != -1) { - savedParentItem.item[replaceIndex] = newResponseItem; - } else { - savedParentItem.item.push(newResponseItem); + if(savedParentItem.item) { + const replaceIndex = savedParentItem.item.findIndex(item => item.linkId == newResponseItem.linkId); + if (replaceIndex != -1) { + savedParentItem.item[replaceIndex] = newResponseItem; + } else { + savedParentItem.item.push(newResponseItem); + } } + }; if (savedParentItem != undefined) { replaceOrInsertItem(newItem, savedParentItem);