From 007fbe0ab2dd68984c689359e4393258cd00c347 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Mon, 13 Dec 2021 15:07:01 +0100 Subject: [PATCH] MOBILE-3946 completion: Fix bug detecting automatic completion --- src/addons/mod/h5pactivity/components/index/index.ts | 4 ++-- src/core/features/course/classes/main-activity-component.ts | 6 +----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/addons/mod/h5pactivity/components/index/index.ts b/src/addons/mod/h5pactivity/components/index/index.ts index 762c6fefe..0f8e18d6f 100644 --- a/src/addons/mod/h5pactivity/components/index/index.ts +++ b/src/addons/mod/h5pactivity/components/index/index.ts @@ -362,11 +362,11 @@ export class AddonModH5PActivityIndexComponent extends CoreCourseModuleMainActiv /** * Play the package. */ - play(): void { + async play(): Promise { this.playing = true; // Mark the activity as viewed. - AddonModH5PActivity.logView(this.h5pActivity!.id, this.h5pActivity!.name, this.siteId); + await AddonModH5PActivity.logView(this.h5pActivity!.id, this.h5pActivity!.name, this.siteId); CoreCourse.checkModuleCompletion(this.courseId, this.module.completiondata); } diff --git a/src/core/features/course/classes/main-activity-component.ts b/src/core/features/course/classes/main-activity-component.ts index fa0d93546..3288f7d65 100644 --- a/src/core/features/course/classes/main-activity-component.ts +++ b/src/core/features/course/classes/main-activity-component.ts @@ -203,11 +203,7 @@ export class CoreCourseModuleMainActivityComponent extends CoreCourseModuleMainR try { if (refresh && this.showCompletion) { - try { - this.module = await CoreCourse.getModule(this.module.id, this.courseId); - } catch { - // Ignore errors. - } + await CoreUtils.ignoreErrors(this.fetchModule()); } await this.fetchContent(refresh, sync, showErrors);