From 5690fafe20e78ffd0519025052c871f946482b2e Mon Sep 17 00:00:00 2001 From: Noel De Martin Date: Tue, 17 Dec 2019 10:26:42 +0100 Subject: [PATCH] MOBILE-3040 submission: Fix isSubmissionEmpty logic --- src/addon/mod/assign/providers/helper.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/addon/mod/assign/providers/helper.ts b/src/addon/mod/assign/providers/helper.ts index 37d6ed427..7cea16eef 100644 --- a/src/addon/mod/assign/providers/helper.ts +++ b/src/addon/mod/assign/providers/helper.ts @@ -193,7 +193,15 @@ export class AddonModAssignHelperProvider { return true; } - return !!submission.plugins.find((plugin) => this.submissionDelegate.isPluginEmpty(assign, plugin)); + for (const plugin of submission.plugins) { + // If any plugin is not empty, we consider that the submission is not empty either. + if (!this.submissionDelegate.isPluginEmpty(assign, plugin)) { + return false; + } + } + + // If all the plugins were empty (or there were no plugins), we consider the submission to be empty. + return true; } /**