Skip to content

Mobile 4653 #4448

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 26, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/addons/mod/lesson/services/lesson.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3187,15 +3187,18 @@ export class AddonModLessonProvider {
}

// Check if "number of attempts remaining" message is needed.
if (!result.correctanswer && !result.newpageid) {
if (!result.correctanswer) {
// Retreive the number of attempts left counter.
if (lesson.maxattempts && lesson.maxattempts > 0 && nAttempts >= lesson.maxattempts) {
if (!result.newpageid && lesson.maxattempts && lesson.maxattempts > 0 && nAttempts >= lesson.maxattempts) {
if (lesson.maxattempts > 1) { // Don't bother with message if only one attempt.
result.maxattemptsreached = true;
}
result.newpageid = AddonModLessonJumpTo.NEXTPAGE;
} else if (lesson.maxattempts && lesson.maxattempts > 1) { // Don't show message if only one attempt or unlimited.
result.attemptsremaining = lesson.maxattempts - nAttempts;
if (result.attemptsremaining <= 0) {
result.maxattemptsreached = true;
}
}
}
}
Expand Down