Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.7.3, 2.8.1
-
MOODLE_27_STABLE, MOODLE_28_STABLE
-
MOODLE_27_STABLE, MOODLE_28_STABLE
-
Difficult
-
Description
Lesson subclusters working is described here: https://docs.moodle.org/28/en/Lesson_clusters#Sub-Clusters and I verified they were working exactly like that in Moodle 1.9.
But the upgrade to Moodle 2.0 completely broke that.
Questions pages inside the subclusters are now treated exactly like the other question pages in the cluster. So no error is produced but subclusters are simply ignored.
Just looking at the code it's pretty evident it can't work !
$unseen = array();
|
foreach ($clusterpages as $key=>$cluster) {
|
if ($cluster->type !== lesson_page::TYPE_QUESTION) {
|
unset($clusterpages[$key]);
|
} elseif ($cluster->is_unseen($seenpages)) {
|
$unseen[] = $cluster;
|
}
|
}
|
So after this loop both the $clusterpages and $unseen arrays only contain question pages, all the other pages have been eliminated including content pages (that were called branchtables in Moodle 1.9) and end of branch pages
So when a few lines after this the code
$nextpage = $unseen[rand(0, count($unseen)-1)];
|
if ($nextpage->qtype == LESSON_PAGE_BRANCHTABLE) {
|
// if branch table, then pick a random page inside of it
|
$branchpages = $this->get_sub_pages_of($nextpage->id, array(LESSON_PAGE_BRANCHTABLE, LESSON_PAGE_ENDOFBRANCH));
|
return $branchpages[rand(0, count($branchpages)-1)]->id;
|
} else { // otherwise, return the page's id
|
return $nextpage->id;
|
}
|
the if condition can never be true and the code in the else is always executed.
Attachments
Issue Links
- is blocked by
-
MDL-31778 Editing a page of type "Cluster" resets its jumping behavior. Once edited the jump cannot be modified to be anything but the next page
-
- Closed
-