diff --git a/src/core/course/components/format/core-course-format.html b/src/core/course/components/format/core-course-format.html index 30ae329e3..cf1712652 100644 --- a/src/core/course/components/format/core-course-format.html +++ b/src/core/course/components/format/core-course-format.html @@ -101,6 +101,6 @@ {{section.count}} / {{section.total}} - + diff --git a/src/core/course/components/format/format.ts b/src/core/course/components/format/format.ts index 6cbf059e0..8c5bdbffe 100644 --- a/src/core/course/components/format/format.ts +++ b/src/core/course/components/format/format.ts @@ -194,7 +194,7 @@ export class CoreCourseFormatComponent implements OnInit, OnChanges, OnDestroy { } } - if (changes.downloadEnabled && this.downloadEnabled) { + if (this.downloadEnabled && (changes.downloadEnabled || changes.sections)) { this.calculateSectionsStatus(false); } } diff --git a/src/core/course/providers/helper.ts b/src/core/course/providers/helper.ts index 448af929d..941a2f9c4 100644 --- a/src/core/course/providers/helper.ts +++ b/src/core/course/providers/helper.ts @@ -1234,7 +1234,7 @@ export class CoreCourseHelperProvider { prefetchSection(section: any, courseId: number, sections?: any[]): Promise { if (section.id != CoreCourseProvider.ALL_SECTIONS_ID) { // Download only this section. - return this.prefetchSingleSectionIfNeeded(section, courseId).then(() => { + return this.prefetchSingleSectionIfNeeded(section, courseId).finally(() => { // Calculate the status of the section that finished. return this.calculateSectionStatus(section, courseId); }); @@ -1246,7 +1246,7 @@ export class CoreCourseHelperProvider { section.isDownloading = true; sections.forEach((section) => { if (section.id != CoreCourseProvider.ALL_SECTIONS_ID) { - promises.push(this.prefetchSingleSectionIfNeeded(section, courseId).then(() => { + promises.push(this.prefetchSingleSectionIfNeeded(section, courseId).finally(() => { // Calculate the status of the section that finished. return this.calculateSectionStatus(section, courseId).then((result) => { // Calculate "All sections" status. diff --git a/src/core/course/providers/module-prefetch-delegate.ts b/src/core/course/providers/module-prefetch-delegate.ts index 5d43db704..24ca8c933 100644 --- a/src/core/course/providers/module-prefetch-delegate.ts +++ b/src/core/course/providers/module-prefetch-delegate.ts @@ -1208,7 +1208,7 @@ export class CoreCourseModulePrefetchDelegate extends CoreDelegate { }); // Set the promise. - prefetchData.promise = Promise.all(promises).finally(() => { + prefetchData.promise = this.utils.allPromises(promises).finally(() => { // Unsubscribe all observers. prefetchData.subscriptions.forEach((subscription: Subscription) => { subscription.unsubscribe();