Merge pull request #1801 from dpalou/MOBILE-2913

Mobile 2913
main
Juan Leyva 2019-03-11 13:44:59 +01:00 committed by GitHub
commit 7e6b260154
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 5 deletions

View File

@ -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>

View File

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

View File

@ -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.

View File

@ -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();