mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
MDL-31775 Lesson Module: fixed start at last page seen bug
This commit is contained in:
parent
832626da76
commit
9530780571
1 changed files with 11 additions and 13 deletions
|
@ -194,20 +194,18 @@ if (empty($pageid)) {
|
||||||
// if there are any questions have been answered correctly in this attempt
|
// if there are any questions have been answered correctly in this attempt
|
||||||
$corrrectattempts = $lesson->get_attempts($retries, true);
|
$corrrectattempts = $lesson->get_attempts($retries, true);
|
||||||
if ($corrrectattempts>0) {
|
if ($corrrectattempts>0) {
|
||||||
foreach ($corrrectattempts as $attempt) {
|
$attempt = end($corrrectattempts);
|
||||||
$jumpto = $DB->get_field('lesson_answers', 'jumpto', array('id' => $attempt->answerid));
|
$jumpto = $DB->get_field('lesson_answers', 'jumpto', array('id' => $attempt->answerid));
|
||||||
// convert the jumpto to a proper page id
|
// convert the jumpto to a proper page id
|
||||||
if ($jumpto == 0) { // unlikely value!
|
if ($jumpto == 0) { // unlikely value!
|
||||||
$lastpageseen = $attempt->pageid;
|
$lastpageseen = $attempt->pageid;
|
||||||
} elseif ($jumpto == LESSON_NEXTPAGE) {
|
} elseif ($jumpto == LESSON_NEXTPAGE) {
|
||||||
if (!$lastpageseen = $DB->get_field('lesson_pages', 'nextpageid', array('id' => $attempt->pageid))) {
|
if (!$lastpageseen = $DB->get_field('lesson_pages', 'nextpageid', array('id' => $attempt->pageid))) {
|
||||||
// no nextpage go to end of lesson
|
// no nextpage go to end of lesson
|
||||||
$lastpageseen = LESSON_EOL;
|
$lastpageseen = LESSON_EOL;
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$lastpageseen = $jumpto;
|
|
||||||
}
|
}
|
||||||
break; // only look at the latest correct attempt
|
} else {
|
||||||
|
$lastpageseen = $jumpto;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue