-
Improvement
-
Resolution: Fixed
-
Minor
-
4.4
-
MOODLE_404_STABLE
-
MOODLE_404_STABLE
-
MDL-79999-main -
-
3
-
HQ 2023 Sprint I4.2 Moppies
A bit of context
The current course_modinfo class indexes all section_info by section number. This limits some features like subsections, as section number is often used as identifiers when they should be only used for sequencing.
This issue is part of the Course hierarchy project, which has the primary goal of including one level of subsections to course content.
The problem
Many internals of course sections take for granted that section number is unique and sequential inside a course. This assumption has been limiting course formats since the first releases and also contaminated all the section APIs (many of them use variables called $section, which are, in fact, section numbers).
The current implementation of course_modinfo indexes all sections by section number, which means that any section without a section number (or with a repeated section number value) will produce unexpected results. Sections should be indexed by ID, the only section attribute that will always be unique.
This issue will refactor the course_modinfo class to cache sections indexed by ID and keep the section number sequencing in a different attribute.