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 * @return If answers are valid
*/ */
isValidResponse(): boolean { isValidResponse(): boolean {
for (const x in this.answers) { return !this.questions.some((question) => {
if (this.answers[x] === -1) { return question.required && question.name &&
return false; (question.type === 0 ? this.answers[question.name] == '' : parseInt(this.answers[question.name], 10) === -1);
} });
}
return true;
} }
/** /**