-
Bug
-
Resolution: Fixed
-
Minor
-
None
-
2.6.7, 2.7.4, 2.8.2
-
None
-
Oracle
-
-
MOODLE_26_STABLE, MOODLE_27_STABLE, MOODLE_28_STABLE
Hi,
When showing Journal as a teacher it counts the number of entries. To calculate that it counts all the entries and removes the ones from unenrolled users. This causes that the number of querys increase 5 querys per entry.
We are using Oracle as DB and Moodle 2.6.7. We've realised that oracle can be the point but not the Moodle version.
Testing that it ha for view.php:
88 reads for a brand new journal activity created.
850 for a journal with about 150 users and entries.
All this is caused by the following code inside journal_count_entries function:
foreach ($journals as $key => $user) {
|
|
$canadd = has_capability('mod/journal:addentries', $context, $user);
|
$entriesmanager = has_capability('mod/journal:manageentries', $context, $user);
|
|
if (!$entriesmanager && !$canadd) {
|
unset($journals[$key]);
|
}
|
}
|
I think this have to be replaced by getting all users enroled and matching both $journals and $userenroled arrays.