From e69f32b5b7166de04275e514c73ffd9af2f6b1a4 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Thu, 5 Jul 2018 10:30:16 +0200 Subject: [PATCH] MOBILE-2466 prefetch: Verify status is valid when prefetching modules --- src/core/course/providers/module-prefetch-delegate.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/course/providers/module-prefetch-delegate.ts b/src/core/course/providers/module-prefetch-delegate.ts index 1e7c5e73f..2693c8fb8 100644 --- a/src/core/course/providers/module-prefetch-delegate.ts +++ b/src/core/course/providers/module-prefetch-delegate.ts @@ -797,7 +797,7 @@ export class CoreCourseModulePrefetchDelegate extends CoreDelegate { const packageId = this.filepoolProvider.getPackageId(handler.component, module.id); promises.push(this.getModuleStatus(module, courseId, updates, refresh).then((modStatus) => { - if (modStatus != CoreConstants.NOT_DOWNLOADABLE) { + if (result[modStatus]) { status = this.filepoolProvider.determinePackagesStatus(status, modStatus); result[modStatus].push(module); result.total++; @@ -808,8 +808,8 @@ export class CoreCourseModulePrefetchDelegate extends CoreDelegate { return Promise.reject(error); } - if (cacheStatus != CoreConstants.NOT_DOWNLOADABLE) { - cacheStatus = this.filepoolProvider.determinePackagesStatus(status, cacheStatus); + if (result[cacheStatus]) { + status = this.filepoolProvider.determinePackagesStatus(status, cacheStatus); result[cacheStatus].push(module); result.total++; }