Skip to content

Commit 02a8c75

Browse files
committed
Fixed when the first entrance at the course, and not cache yet for the last acces section, and the get_sections_to_display, changed to protected
1 parent 10fd69b commit 02a8c75

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

classes/output/courseformat/content.php

+7-3
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ static function save_last_section_access($courseid, $section)
449449
}
450450

451451
/**
452-
* Retornar la ultima sección del usuario
452+
* Retornar la última sección del usuario
453453
* @param $courseid
454454
* @return array|bool|float|int|mixed|\stdClass|string
455455
* @throws \coding_exception
@@ -459,7 +459,11 @@ static function get_last_section_access($courseid)
459459
global $USER;
460460

461461
$cache = cache::make('format_buttons', 'user_last_section');
462-
return $cache->get($USER->id . '_' . $courseid);
462+
$section = $cache->get($USER->id . '_' . $courseid);
463+
if (!$section) {
464+
$section = 1;
465+
}
466+
return $section;
463467
}
464468

465469
/**
@@ -469,7 +473,7 @@ static function get_last_section_access($courseid)
469473
* @return array|\core_courseformat\output\local\section_info[]
470474
* @throws \moodle_exception
471475
*/
472-
private function get_sections_to_display(\course_modinfo $modinfo): array
476+
protected function get_sections_to_display(\course_modinfo $modinfo): array
473477
{
474478
$singlesection = $this->format->get_section_number();
475479
if ($singlesection) {

version.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@
2626

2727
$plugin->component = 'format_buttons';
2828
$plugin->release = '4.x';
29-
$plugin->version = 2025031300;
29+
$plugin->version = 2025031600;
3030
$plugin->requires = 2023042400;
3131
$plugin->maturity = MATURITY_STABLE;

0 commit comments

Comments
 (0)