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 13:34:04 +00:00
co-authored by Leon Stringer
parent a2653cc924
commit b054c7eaf5
2 changed files with 19 additions and 5 deletions
+10 -4
View File
@@ -789,17 +789,23 @@ $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;
//
// Default question bank module
//
// $CFG->corequestion_defaultqbankmod = 'qbank'
// $CFG->corequestion_defaultqbankmod = 'qbank'
//
// Question banks are only stored at activity module context and this setting defines which module type will
// be used for creating question banks by default. This is in circumstances such as quiz backup & restores when
// no target context can be found and the system needs to create a question bank to store the categories and questions.
//
// 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()));
}
/**