From 97d4f6d4edfde231fe2e2c5cc2a0297b29d2ebb6 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Tue, 29 Jan 2019 13:03:31 +0100 Subject: [PATCH] MOBILE-2844 assign: Fix prefetch error if grader was -1 --- src/addon/mod/assign/providers/prefetch-handler.ts | 2 +- src/core/user/providers/user.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/addon/mod/assign/providers/prefetch-handler.ts b/src/addon/mod/assign/providers/prefetch-handler.ts index d7a86836a..93ecb3f68 100644 --- a/src/addon/mod/assign/providers/prefetch-handler.ts +++ b/src/addon/mod/assign/providers/prefetch-handler.ts @@ -392,7 +392,7 @@ export class AddonModAssignPrefetchHandler extends CoreCourseActivityPrefetchHan // Prefetch feedback. if (submission.feedback) { // Get profile and image of the grader. - if (submission.feedback.grade && submission.feedback.grade.grader) { + if (submission.feedback.grade && submission.feedback.grade.grader && submission.feedback.grade.grader != -1) { userIds.push(submission.feedback.grade.grader); } diff --git a/src/core/user/providers/user.ts b/src/core/user/providers/user.ts index 2a4d83d47..242c586d6 100644 --- a/src/core/user/providers/user.ts +++ b/src/core/user/providers/user.ts @@ -397,7 +397,7 @@ export class CoreUserProvider { userId = Number(userId); // Make sure it's a number. // Prevent repeats and errors. - if (!isNaN(userId) && !treated[userId]) { + if (!isNaN(userId) && !treated[userId] && userId > 0) { treated[userId] = true; promises.push(this.getProfile(userId, courseId, false, siteId).then((profile) => {