MOBILE-2905 Fix bug with NaN appearing for size
This commit is contained in:
		
							parent
							
								
									e63b1ff8ab
								
							
						
					
					
						commit
						3e9326d477
					
				| @ -61,6 +61,7 @@ export class AddonStorageManagerCourseStoragePage { | ||||
|                 section.totalSize = 0; | ||||
|                 section.modules.forEach((module) => { | ||||
|                     module.parentSection = section; | ||||
|                     module.totalSize = 0; | ||||
|                     // Note: This function only gets the size for modules which are downloadable.
 | ||||
|                     // For other modules it always returns 0, even if they have downloaded some files.
 | ||||
|                     // However there is no 100% reliable way to actually track the files in this case.
 | ||||
| @ -70,9 +71,12 @@ export class AddonStorageManagerCourseStoragePage { | ||||
|                     // Most modules which have large files are downloadable, so I think this is sufficient.
 | ||||
|                     const promise = this.prefetchDelegate.getModuleDownloadedSize(module, this.course.id). | ||||
|                         then((size) => { | ||||
|                             module.totalSize = size; | ||||
|                             section.totalSize += size; | ||||
|                             this.totalSize += size; | ||||
|                             // There are some cases where the return from this is not a valid number.
 | ||||
|                             if (!isNaN(size)) { | ||||
|                                 module.totalSize = Number(size); | ||||
|                                 section.totalSize += size; | ||||
|                                 this.totalSize += size; | ||||
|                             } | ||||
|                         }); | ||||
|                     allPromises.push(promise); | ||||
|                 }); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user