MOBILE-4470 lesson: Fix multichoice option not selected in review

Fixes a regression caused by 2449aca
main
Dani Palou 2024-05-29 10:32:00 +02:00
parent 1d135e62d2
commit f1ccc63795
1 changed files with 8 additions and 3 deletions

View File

@ -269,9 +269,14 @@ export class AddonModLessonHelperProvider {
if (option.checked || multiChoiceQuestion.multi) {
// Add the control.
const value = multiChoiceQuestion.multi ?
{ value: option.checked, disabled: option.disabled } : option.checked;
questionForm.addControl(option.name, this.formBuilder.control(value));
if (multiChoiceQuestion.multi) {
questionForm.addControl(
option.name,
this.formBuilder.control({ value: option.checked, disabled: option.disabled }),
);
} else {
questionForm.addControl(option.name, this.formBuilder.control(option.value));
}
controlAdded = true;
}