diff --git a/src/components/questions/choice-question/choice-question.tsx b/src/components/questions/choice-question/choice-question.tsx index 984a824..fdc9995 100644 --- a/src/components/questions/choice-question/choice-question.tsx +++ b/src/components/questions/choice-question/choice-question.tsx @@ -59,13 +59,14 @@ export class ChoiceQuestion { @Prop() question: any; @Watch('question') async watchQuestion() { - //TODO get correct response when questions updates try { this.optionsList = await this.getChoiceOptions(); } catch (error) { alert(error); } + this.allow_events = false; this.setSelected(); + this.allow_events = true; this.repeats = this.question.repeats; } @Prop() answers: any; @@ -84,7 +85,7 @@ export class ChoiceQuestion { @Watch('questionnaireResponse') async watchQuestionnaireResponse() { this.allow_events = false; - await this.setSelected(); //TODO Hier ist der Übeltäter + await this.setSelected(); this.allow_events = true; } /** @@ -175,7 +176,6 @@ export class ChoiceQuestion { */ setSelected() { let data = questionnaireResponseController.getAnswersFromQuestionnaireResponse(this.questionnaireResponse, this.question.linkId, 'coding'); - if (this.question.repeats) { this.selected = data; } else { @@ -239,13 +239,7 @@ export class ChoiceQuestion { {this.optionsList.map(answer => (
this.onBoxClickedMultipleChoice(answer.display, answer.code)}> - + diff --git a/src/utils/questionnaireResponseController.ts b/src/utils/questionnaireResponseController.ts index aee3e80..7af80c4 100644 --- a/src/utils/questionnaireResponseController.ts +++ b/src/utils/questionnaireResponseController.ts @@ -246,7 +246,7 @@ export function getAnswersFromQuestionnaireResponse(questionnaireResponse, linkI case valueTypes.STRING: answerValue = itemList[i].answer[0].valueString; break; - case valueTypes.CODING: + case valueTypes.CODING: for (let a = 0; a < itemList[i].answer.length; a++) { // codingValue.push( // Object.assign({