MDL-81254 grade: ensure we always close the graded user iterator.

This ensures that the recordsets contained within are also closed
when we're done with them.
This commit is contained in:
Paul Holden
2024-03-15 14:59:11 +00:00
parent 70f611116d
commit 357445b43c
3 changed files with 3 additions and 2 deletions
+1
View File
@@ -238,6 +238,7 @@ if (($itemtype !== 'select') && ($itemtype !== 'grade_select') &&($itemtype !==
$stickyfooter = new core\output\sticky_footer($footercontent);
$stickyfooter = $OUTPUT->render($stickyfooter);
$gui->close();
}
echo $OUTPUT->render_from_template('gradereport_singleview/report', [
+2 -1
View File
@@ -170,7 +170,6 @@ if (has_capability('moodle/grade:viewall', $context)) {
echo $report->print_table(true);
}
}
$gui->close();
} else { // Show one user's report.
// Store the id of the current user item in a session variable which represents the last viewed item.
$SESSION->gradereport_user["useritem-{$context->id}"] = $userid;
@@ -192,6 +191,8 @@ if (has_capability('moodle/grade:viewall', $context)) {
$stickyfooter = new core\output\sticky_footer($userreportrenderer->user_navigation($gui, $userid, $courseid));
echo $OUTPUT->render($stickyfooter);
}
$gui->close();
} else {
// Students will see just their own report.
// Create a report instance.
-1
View File
@@ -131,7 +131,6 @@ class gradereport_user_renderer extends plugin_renderer_base {
while ($userdata = $gui->next_user()) {
$users[$userdata->user->id] = $userdata->user;
}
$gui->close();
$arraykeys = array_keys($users);
$keynumber = array_search($userid, $arraykeys);