MOBILE-3213 survey: Check question is required to disable the submission

main
Pau Ferrer Ocaña 2019-12-16 17:20:48 +01:00
parent 67b5deb5bc
commit a6e68c7176
1 changed files with 4 additions and 7 deletions

View File

@ -163,13 +163,10 @@ export class AddonModSurveyIndexComponent extends CoreCourseModuleMainActivityCo
* @return If answers are valid
*/
isValidResponse(): boolean {
for (const x in this.answers) {
if (this.answers[x] === -1) {
return false;
}
}
return true;
return !this.questions.some((question) => {
return question.required && question.name &&
(question.type === 0 ? this.answers[question.name] == '' : parseInt(this.answers[question.name], 10) === -1);
});
}
/**