commit
7e6b260154
|
@ -101,6 +101,6 @@
|
|||
<!-- Download progress. -->
|
||||
<ion-badge class="core-course-download-section-progress" *ngIf="section.isDownloading && section.total > 0 && section.count < section.total">{{section.count}} / {{section.total}}</ion-badge>
|
||||
<!-- Spinner (downloading or calculating status). -->
|
||||
<ion-spinner *ngIf="(section.isDownloading && section.total > 0) || section.isCalculating"></ion-spinner>
|
||||
<ion-spinner *ngIf="section.isDownloading || section.isCalculating"></ion-spinner>
|
||||
</div>
|
||||
</ng-template>
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1234,7 +1234,7 @@ export class CoreCourseHelperProvider {
|
|||
prefetchSection(section: any, courseId: number, sections?: any[]): Promise<any> {
|
||||
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.
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue