Skip to content

Commit 322d6ad

Browse files
committed
MOBILE-2915 lesson: Improve buttons displayed if finished offline
1 parent ce8699a commit 322d6ad

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

src/addon/mod/lesson/components/index/addon-mod-lesson-index.html

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
<a ion-button block (click)="review()">{{ 'addon.mod_lesson.review' | translate }}</a>
5959
</ion-item>
6060

61-
<ion-item text-wrap *ngIf="leftDuringTimed && !lesson.timelimit">
61+
<ion-item text-wrap *ngIf="leftDuringTimed && !lesson.timelimit && !finishedOffline">
6262
<!-- User left during the session and there is no time limit, ask to continue. -->
6363
<p [innerHTML]="'addon.mod_lesson.youhaveseen' | translate"></p>
6464
<ion-grid>
@@ -73,7 +73,7 @@
7373
</ion-grid>
7474
</ion-item>
7575

76-
<ion-item text-wrap *ngIf="leftDuringTimed && lesson.timelimit && lesson.retake">
76+
<ion-item text-wrap *ngIf="leftDuringTimed && lesson.timelimit && lesson.retake && !finishedOffline">
7777
<!-- User left during the session with time limit and retakes allowed, ask to continue. -->
7878
<p [innerHTML]="'addon.mod_lesson.leftduringtimed' | translate"></p>
7979
<a ion-button block icon-end (click)="start(false)">
@@ -87,7 +87,7 @@
8787
<p [innerHTML]="'addon.mod_lesson.leftduringtimednoretake' | translate"></p>
8888
</ion-item>
8989

90-
<ion-item text-wrap *ngIf="!leftDuringTimed">
90+
<ion-item text-wrap *ngIf="!leftDuringTimed && !finishedOffline">
9191
<!-- User hasn't left during the session, show a start button. -->
9292
<a ion-button block *ngIf="!canManage" icon-end (click)="start(false)">
9393
{{ 'core.start' | translate }}
@@ -98,6 +98,14 @@
9898
<ion-icon name="search"></ion-icon>
9999
</a>
100100
</ion-item>
101+
102+
<ion-item text-wrap *ngIf="finishedOffline">
103+
<!-- There's an attempt finished in offline. Let the user continue, showing the end of lesson. -->
104+
<a ion-button block icon-end (click)="start(true)">
105+
{{ 'addon.mod_lesson.continue' | translate }}
106+
<ion-icon name="arrow-forward" md="ios-arrow-forward"></ion-icon>
107+
</a>
108+
</ion-item>
101109
</ion-list>
102110
</core-loading>
103111
</ng-template>

src/addon/mod/lesson/components/index/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ export class AddonModLessonIndexComponent extends CoreCourseModuleMainActivityCo
5656
reportLoaded: boolean; // Whether the report data has been loaded.
5757
selectedGroupName: string; // The name of the selected group.
5858
overview: any; // Reports overview data.
59+
finishedOffline: boolean; // Whether a retake was finished in offline.
5960

6061
protected syncEventName = AddonModLessonSyncProvider.AUTO_SYNCED;
6162
protected accessInfo: any; // Lesson access info.
@@ -159,6 +160,11 @@ export class AddonModLessonIndexComponent extends CoreCourseModuleMainActivityCo
159160
}
160161
}));
161162

163+
// Check if the ser has a finished retake in offline.
164+
promises.push(this.lessonOffline.hasFinishedRetake(this.lesson.id).then((finished) => {
165+
this.finishedOffline = finished;
166+
}));
167+
162168
// Update the list of content pages viewed and question attempts.
163169
promises.push(this.lessonProvider.getContentPagesViewedOnline(this.lesson.id, info.attemptscount));
164170
promises.push(this.lessonProvider.getQuestionsAttemptsOnline(this.lesson.id, info.attemptscount));

0 commit comments

Comments
 (0)