MOBILE-2905 Fix bug with NaN appearing for size
parent
e63b1ff8ab
commit
3e9326d477
|
@ -61,6 +61,7 @@ export class AddonStorageManagerCourseStoragePage {
|
||||||
section.totalSize = 0;
|
section.totalSize = 0;
|
||||||
section.modules.forEach((module) => {
|
section.modules.forEach((module) => {
|
||||||
module.parentSection = section;
|
module.parentSection = section;
|
||||||
|
module.totalSize = 0;
|
||||||
// Note: This function only gets the size for modules which are downloadable.
|
// 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.
|
// 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.
|
// 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.
|
// Most modules which have large files are downloadable, so I think this is sufficient.
|
||||||
const promise = this.prefetchDelegate.getModuleDownloadedSize(module, this.course.id).
|
const promise = this.prefetchDelegate.getModuleDownloadedSize(module, this.course.id).
|
||||||
then((size) => {
|
then((size) => {
|
||||||
module.totalSize = size;
|
// There are some cases where the return from this is not a valid number.
|
||||||
section.totalSize += size;
|
if (!isNaN(size)) {
|
||||||
this.totalSize += size;
|
module.totalSize = Number(size);
|
||||||
|
section.totalSize += size;
|
||||||
|
this.totalSize += size;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
allPromises.push(promise);
|
allPromises.push(promise);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue