Merge pull request #1915 from sammarshallou/MOBILE-2905
MOBILE-2905 Fix bug with NaN appearing for sizemain
commit
6dd8786da6
|
@ -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;
|
||||
// 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…
Reference in New Issue