MDL-83297 gradereport_grader: Make maxgradesperpage configurable

After deploying to our production environment, we noticed that for large gradebooks, having a max of 200,000 grades per
page was still too high and resulted in the gradebook page crashing or failing to load entirely. This commit will make
this value configurable (e.g. ->maxgradesperpage = 70000) rather than a constant so that other institutions can tune it.

Co-authored-by: Leon Stringer <[email protected]>
This commit is contained in:
dragos5436
2025-01-21 12:32:33 +00:00
co-authored by Leon Stringer
parent e6c92dc291
commit bfcdb5100f
2 changed files with 17 additions and 3 deletions
+8 -2
View File
@@ -789,8 +789,14 @@ $CFG->admin = 'admin';
// polling should be done and latest update retrieved.
// If no value is set, then it will default to 5 seconds.
//
// $CFG->progresspollinterval = 5;
// $CFG->progresspollinterval = 5;
//
// Set limit for grade items that can be shown on a single page of the grader
// report. Browsers struggle when the number of grade items is very large and
// one tries to view all students.
//
// $CFG->maxgradesperpage = 200000;
//
//=========================================================================
// 7. SETTINGS FOR DEVELOPMENT SERVERS - not intended for production use!!!
//=========================================================================
+9 -1
View File
@@ -547,7 +547,15 @@ class grade_report_grader extends grade_report {
* @return int
*/
public function get_max_students_per_page(): int {
return round(static::MAX_GRADES_PER_PAGE / count($this->get_allgradeitems()));
global $CFG;
if (isset($CFG->maxgradesperpage) && clean_param($CFG->maxgradesperpage, PARAM_INT) > 0) {
$maxgradesperpage = $CFG->maxgradesperpage;
} else {
$maxgradesperpage = self::MAX_GRADES_PER_PAGE;
}
return round($maxgradesperpage / count($this->get_allgradeitems()));
}
/**