Merge pull request #1395 from dpalou/MOBILE-2466

MOBILE-2466 prefetch: Verify status is valid when prefetching modules
main
Juan Leyva 2018-07-05 11:05:00 +02:00 committed by GitHub
commit e141000c3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -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++;
}