Skip to content

Commit

Permalink
MDL-81481 assign grading: speed up assign 'View all submissions' page
Browse files Browse the repository at this point in the history
the 'View all submissions' page was fairly slow when dealing with large databases.

Solution: Utilize a static 'capability_checker' in 'filter_user_list' to prevent reinitialization.
 Requests made by 'get_users_by_capability' will be cached, thus enhancing performance for large databases.
  • Loading branch information
t-schroeder authored and Marvin-Kirch committed Jan 22, 2025
1 parent 263b3c3 commit 746e375
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion availability/classes/info.php
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,12 @@ public function filter_user_list(array $users) {
return $users;
}
$tree = $this->get_availability_tree();
$checker = new capability_checker($this->get_context());
static $checkers = [];
$context = $this->get_context();
if (!array_key_exists($context->id, $checkers)) {
$checkers[$context->id] = new capability_checker($context);
}
$checker = $checkers[$context->id];

// Filter using availability tree.
$this->modinfo = get_fast_modinfo($this->get_course());
Expand Down

0 comments on commit 746e375

Please sign in to comment.