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

28 bug single choice question multiple choice question in succession #30

Merged
Show file tree
Hide file tree
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
14 changes: 4 additions & 10 deletions src/components/questions/choice-question/choice-question.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
/**
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -239,13 +239,7 @@ export class ChoiceQuestion {
{this.optionsList.map(answer => (
<div id={answer.code} class="card radio-button-card" style={{ background: this.checkIfSelected(answer) ? '#e8f4fd' : 'white' }}>
<div class="form-check" onClick={() => this.onBoxClickedMultipleChoice(answer.display, answer.code)}>
<input
class="form-check-input radio-button"
type="checkbox"
name={'Checkbox' + this.question.linkId}
id={answer.code}
defaultChecked={this.checkIfSelected(answer)}
/>
<input class="form-check-input radio-button" type="checkbox" name={'Checkbox' + this.question.linkId} id={answer.code} defaultChecked={this.checkIfSelected(answer)} />
<label class="form-check-label title" htmlFor={answer.code}>
{answer.display}
</label>
Expand Down
2 changes: 1 addition & 1 deletion src/utils/questionnaireResponseController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down