MDL-76147 gradereport_grader: Fix collapsing preferences.

At certain cases I didn't see a tick in view mode. For example
when I click grades only and then switch to totals only a tick
next to total only was not shown. I think this is caused since before
mode was changed in circlurar order i.e.
fullmode->grade only->aggregate only->fullmode. But now any order is
possible so we need to respect it
This commit is contained in:
Ilya Tregubov
2023-03-24 09:26:45 +08:00
parent ca60efb89f
commit fd2b6f5ca9
+4
View File
@@ -1893,6 +1893,10 @@ class grade_report_grader extends grade_report {
switch ($action) {
case 'switch_minus': // Add category to array of aggregatesonly
$key = array_search($targetid, $collapsed['gradesonly']);
if ($key !== false) {
unset($collapsed['gradesonly'][$key]);
}
if (!in_array($targetid, $collapsed['aggregatesonly'])) {
$collapsed['aggregatesonly'][] = $targetid;
static::set_collapsed_preferences($courseid, $collapsed);