forked from CIT/Vmeda.Online
		
	MOBILE-2913 course: Fix section progress when an error happens
This commit is contained in:
		
							parent
							
								
									900c9b741e
								
							
						
					
					
						commit
						f5f04b35c1
					
				| @ -101,6 +101,6 @@ | |||||||
|         <!-- Download progress. --> |         <!-- 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> |         <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). --> |         <!-- 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> |     </div> | ||||||
| </ng-template> | </ng-template> | ||||||
|  | |||||||
| @ -1234,7 +1234,7 @@ export class CoreCourseHelperProvider { | |||||||
|     prefetchSection(section: any, courseId: number, sections?: any[]): Promise<any> { |     prefetchSection(section: any, courseId: number, sections?: any[]): Promise<any> { | ||||||
|         if (section.id != CoreCourseProvider.ALL_SECTIONS_ID) { |         if (section.id != CoreCourseProvider.ALL_SECTIONS_ID) { | ||||||
|             // Download only this section.
 |             // Download only this section.
 | ||||||
|             return this.prefetchSingleSectionIfNeeded(section, courseId).then(() => { |             return this.prefetchSingleSectionIfNeeded(section, courseId).finally(() => { | ||||||
|                 // Calculate the status of the section that finished.
 |                 // Calculate the status of the section that finished.
 | ||||||
|                 return this.calculateSectionStatus(section, courseId); |                 return this.calculateSectionStatus(section, courseId); | ||||||
|             }); |             }); | ||||||
| @ -1246,7 +1246,7 @@ export class CoreCourseHelperProvider { | |||||||
|             section.isDownloading = true; |             section.isDownloading = true; | ||||||
|             sections.forEach((section) => { |             sections.forEach((section) => { | ||||||
|                 if (section.id != CoreCourseProvider.ALL_SECTIONS_ID) { |                 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.
 |                         // Calculate the status of the section that finished.
 | ||||||
|                         return this.calculateSectionStatus(section, courseId).then((result) => { |                         return this.calculateSectionStatus(section, courseId).then((result) => { | ||||||
|                             // Calculate "All sections" status.
 |                             // Calculate "All sections" status.
 | ||||||
|  | |||||||
| @ -1208,7 +1208,7 @@ export class CoreCourseModulePrefetchDelegate extends CoreDelegate { | |||||||
|         }); |         }); | ||||||
| 
 | 
 | ||||||
|         // Set the promise.
 |         // Set the promise.
 | ||||||
|         prefetchData.promise = Promise.all(promises).finally(() => { |         prefetchData.promise = this.utils.allPromises(promises).finally(() => { | ||||||
|             // Unsubscribe all observers.
 |             // Unsubscribe all observers.
 | ||||||
|             prefetchData.subscriptions.forEach((subscription: Subscription) => { |             prefetchData.subscriptions.forEach((subscription: Subscription) => { | ||||||
|                 subscription.unsubscribe(); |                 subscription.unsubscribe(); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user