Skip to content

Commit 94d4876

Browse files
t-schroederMarvin-Kirch
authored andcommitted
MDL-81481 assign grading: speed up assign 'View all submissions' page
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.
1 parent a2653cc commit 94d4876

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

availability/classes/info.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,12 @@ public function filter_user_list(array $users) {
637637
return $users;
638638
}
639639
$tree = $this->get_availability_tree();
640-
$checker = new capability_checker($this->get_context());
640+
static $checkers = [];
641+
$context = $this->get_context();
642+
if (!array_key_exists($context->id, $checkers)) {
643+
$checkers[$context->id] = new capability_checker($context);
644+
}
645+
$checker = $checkers[$context->id];
641646

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

0 commit comments

Comments
 (0)