Skip to content

Commit 2f1171f

Browse files
committed
MOBILE-2915 lesson: Allow review when max attempts reached
1 parent d81004f commit 2f1171f

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/addon/mod/lesson/pages/player/player.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy {
245245

246246
if (info.preventaccessreasons && info.preventaccessreasons.length) {
247247
// If it's a password protected lesson and we have the password, allow playing it.
248-
const preventReason = this.lessonProvider.getPreventAccessReason(info, !!this.password);
248+
const preventReason = this.lessonProvider.getPreventAccessReason(info, !!this.password, this.review);
249249
if (preventReason) {
250250
// Lesson cannot be played, show message and go back.
251251
return Promise.reject(preventReason.message);

src/addon/mod/lesson/providers/lesson.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2367,9 +2367,10 @@ export class AddonModLessonProvider {
23672367
*
23682368
* @param {any} info Lesson access info.
23692369
* @param {boolean} [ignorePassword] Whether password protected reason should be ignored (user already entered the password).
2370+
* @param {boolean} [isReview] Whether user is reviewing a retake.
23702371
* @return {any} Prevent access reason.
23712372
*/
2372-
getPreventAccessReason(info: any, ignorePassword?: boolean): any {
2373+
getPreventAccessReason(info: any, ignorePassword?: boolean, isReview?: boolean): any {
23732374
let result;
23742375

23752376
if (info && info.preventaccessreasons) {
@@ -2384,6 +2385,8 @@ export class AddonModLessonProvider {
23842385
// Treat password before all other reasons.
23852386
result = entry;
23862387
}
2388+
} else if (entry.reason == 'noretake' && isReview) {
2389+
// Ignore noretake error when reviewing.
23872390
} else if (!result) {
23882391
// Rest of cases, just return any of them.
23892392
result = entry;

0 commit comments

Comments
 (0)