diff --git a/src/addon/storagemanager/pages/course-storage/course-storage.ts b/src/addon/storagemanager/pages/course-storage/course-storage.ts index 9e38df36c..f3ec571e1 100644 --- a/src/addon/storagemanager/pages/course-storage/course-storage.ts +++ b/src/addon/storagemanager/pages/course-storage/course-storage.ts @@ -72,7 +72,7 @@ export class AddonStorageManagerCourseStoragePage { // But these aren't necessarily consistent, for example mod_frog vs mmaModFrog. // There is nothing enforcing correct values. // Most modules which have large files are downloadable, so I think this is sufficient. - const promise = this.prefetchDelegate.getModuleTotalSize(module, this.course.id). + const promise = this.prefetchDelegate.getModuleStoredSize(module, this.course.id). then((size) => { // There are some cases where the return from this is not a valid number. if (!isNaN(size)) { diff --git a/src/classes/site.ts b/src/classes/site.ts index 86fc69c6d..14bbf40fb 100644 --- a/src/classes/site.ts +++ b/src/classes/site.ts @@ -1200,9 +1200,13 @@ export class CoreSite { * @param componentId Component id. * @return Promise resolved when the entries are deleted. */ - deleteComponentFromCache(component: string, componentId?: string): Promise { + async deleteComponentFromCache(component: string, componentId?: string): Promise { + if (!component) { + return; + } + if (!this.db) { - return Promise.reject(null); + throw new Error('Site DB not initialized'); } const params = { diff --git a/src/core/course/providers/helper.ts b/src/core/course/providers/helper.ts index 870bced3c..f91b189d9 100644 --- a/src/core/course/providers/helper.ts +++ b/src/core/course/providers/helper.ts @@ -1136,7 +1136,7 @@ export class CoreCourseHelperProvider { this.prefetchDelegate.invalidateModuleStatusCache(module); } - promises.push(this.prefetchDelegate.getModuleTotalSize(module, courseId).then((moduleSize) => { + promises.push(this.prefetchDelegate.getModuleStoredSize(module, courseId).then((moduleSize) => { moduleInfo.size = moduleSize; moduleInfo.sizeReadable = this.textUtils.bytesToSize(moduleSize, 2); })); diff --git a/src/core/course/providers/module-prefetch-delegate.ts b/src/core/course/providers/module-prefetch-delegate.ts index a42d080c5..462f7ce83 100644 --- a/src/core/course/providers/module-prefetch-delegate.ts +++ b/src/core/course/providers/module-prefetch-delegate.ts @@ -699,7 +699,7 @@ export class CoreCourseModulePrefetchDelegate extends CoreDelegate { * @param courseId Course ID the module belongs to. * @return Promise resolved with the total size (0 if unknown) */ - getModuleTotalSize(module: any, courseId: number): Promise { + getModuleStoredSize(module: any, courseId: number): Promise { return this.getModuleDownloadedSize(module, courseId).then((downloadedSize) => { if (isNaN(downloadedSize)) { downloadedSize = 0;