public function get_last_section_number() {
        $course = $this->get_course();
        if (isset($course->numsections)) {
            return $course->numsections;
        }
        $modinfo = get_fast_modinfo($course);
        $sections = $modinfo->get_section_info_all();
        return (int)max(array_keys($sections));
    }