MOBILE-2915 lesson: Improve buttons displayed if finished offline
parent
ce8699a03f
commit
322d6ad2ca
|
@ -58,7 +58,7 @@
|
|||
<a ion-button block (click)="review()">{{ 'addon.mod_lesson.review' | translate }}</a>
|
||||
</ion-item>
|
||||
|
||||
<ion-item text-wrap *ngIf="leftDuringTimed && !lesson.timelimit">
|
||||
<ion-item text-wrap *ngIf="leftDuringTimed && !lesson.timelimit && !finishedOffline">
|
||||
<!-- User left during the session and there is no time limit, ask to continue. -->
|
||||
<p [innerHTML]="'addon.mod_lesson.youhaveseen' | translate"></p>
|
||||
<ion-grid>
|
||||
|
@ -73,7 +73,7 @@
|
|||
</ion-grid>
|
||||
</ion-item>
|
||||
|
||||
<ion-item text-wrap *ngIf="leftDuringTimed && lesson.timelimit && lesson.retake">
|
||||
<ion-item text-wrap *ngIf="leftDuringTimed && lesson.timelimit && lesson.retake && !finishedOffline">
|
||||
<!-- User left during the session with time limit and retakes allowed, ask to continue. -->
|
||||
<p [innerHTML]="'addon.mod_lesson.leftduringtimed' | translate"></p>
|
||||
<a ion-button block icon-end (click)="start(false)">
|
||||
|
@ -87,7 +87,7 @@
|
|||
<p [innerHTML]="'addon.mod_lesson.leftduringtimednoretake' | translate"></p>
|
||||
</ion-item>
|
||||
|
||||
<ion-item text-wrap *ngIf="!leftDuringTimed">
|
||||
<ion-item text-wrap *ngIf="!leftDuringTimed && !finishedOffline">
|
||||
<!-- User hasn't left during the session, show a start button. -->
|
||||
<a ion-button block *ngIf="!canManage" icon-end (click)="start(false)">
|
||||
{{ 'core.start' | translate }}
|
||||
|
@ -98,6 +98,14 @@
|
|||
<ion-icon name="search"></ion-icon>
|
||||
</a>
|
||||
</ion-item>
|
||||
|
||||
<ion-item text-wrap *ngIf="finishedOffline">
|
||||
<!-- There's an attempt finished in offline. Let the user continue, showing the end of lesson. -->
|
||||
<a ion-button block icon-end (click)="start(true)">
|
||||
{{ 'addon.mod_lesson.continue' | translate }}
|
||||
<ion-icon name="arrow-forward" md="ios-arrow-forward"></ion-icon>
|
||||
</a>
|
||||
</ion-item>
|
||||
</ion-list>
|
||||
</core-loading>
|
||||
</ng-template>
|
||||
|
|
|
@ -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));
|
||||
|
|
Loading…
Reference in New Issue