From 322d6ad2ca863878c13a787471f9256c6545d408 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Thu, 28 Mar 2019 09:21:44 +0100 Subject: [PATCH] MOBILE-2915 lesson: Improve buttons displayed if finished offline --- .../components/index/addon-mod-lesson-index.html | 14 +++++++++++--- src/addon/mod/lesson/components/index/index.ts | 6 ++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/addon/mod/lesson/components/index/addon-mod-lesson-index.html b/src/addon/mod/lesson/components/index/addon-mod-lesson-index.html index 61a19ce3c..c0c7b311a 100644 --- a/src/addon/mod/lesson/components/index/addon-mod-lesson-index.html +++ b/src/addon/mod/lesson/components/index/addon-mod-lesson-index.html @@ -58,7 +58,7 @@ {{ 'addon.mod_lesson.review' | translate }} - +

@@ -73,7 +73,7 @@
- +

@@ -87,7 +87,7 @@

- + {{ 'core.start' | translate }} @@ -98,6 +98,14 @@
+ + + + + {{ 'addon.mod_lesson.continue' | translate }} + + + diff --git a/src/addon/mod/lesson/components/index/index.ts b/src/addon/mod/lesson/components/index/index.ts index 0f98b9444..3750b56dc 100644 --- a/src/addon/mod/lesson/components/index/index.ts +++ b/src/addon/mod/lesson/components/index/index.ts @@ -56,6 +56,7 @@ export class AddonModLessonIndexComponent extends CoreCourseModuleMainActivityCo reportLoaded: boolean; // Whether the report data has been loaded. selectedGroupName: string; // The name of the selected group. overview: any; // Reports overview data. + finishedOffline: boolean; // Whether a retake was finished in offline. protected syncEventName = AddonModLessonSyncProvider.AUTO_SYNCED; protected accessInfo: any; // Lesson access info. @@ -159,6 +160,11 @@ export class AddonModLessonIndexComponent extends CoreCourseModuleMainActivityCo } })); + // Check if the ser has a finished retake in offline. + promises.push(this.lessonOffline.hasFinishedRetake(this.lesson.id).then((finished) => { + this.finishedOffline = finished; + })); + // Update the list of content pages viewed and question attempts. promises.push(this.lessonProvider.getContentPagesViewedOnline(this.lesson.id, info.attemptscount)); promises.push(this.lessonProvider.getQuestionsAttemptsOnline(this.lesson.id, info.attemptscount));