Skip to content

Commit

Permalink
MDL-40259 - For SCORM reports limit fields returned from
Browse files Browse the repository at this point in the history
get_users_by_capability to user ID to decrease memory utilization
  • Loading branch information
Tim Gus committed Jun 20, 2013
1 parent 6c41397 commit 134a6dd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions mod/scorm/report/basic/report.php
Expand Up @@ -83,21 +83,23 @@ function display($scorm, $cm, $course, $download) {


if (empty($currentgroup)) { if (empty($currentgroup)) {
// all users who can attempt scoes // all users who can attempt scoes
if (!$students = get_users_by_capability($contextmodule, 'mod/scorm:savetrack', '', '', '', '', '', '', false)) { if (!$students = get_users_by_capability($contextmodule, 'mod/scorm:savetrack', 'u.id', '', '', '', '', '', false)) {
echo $OUTPUT->notification(get_string('nostudentsyet')); echo $OUTPUT->notification(get_string('nostudentsyet'));
$nostudents = true; $nostudents = true;
$allowedlist = ''; $allowedlist = '';
} else { } else {
$allowedlist = array_keys($students); $allowedlist = array_keys($students);
} }
unset($students);
} else { } else {
// all users who can attempt scoes and who are in the currently selected group // all users who can attempt scoes and who are in the currently selected group
if (!$groupstudents = get_users_by_capability($contextmodule, 'mod/scorm:savetrack', '', '', '', '', $currentgroup, '', false)) { if (!$groupstudents = get_users_by_capability($contextmodule, 'mod/scorm:savetrack', 'u.id', '', '', '', $currentgroup, '', false)) {
echo $OUTPUT->notification(get_string('nostudentsingroup')); echo $OUTPUT->notification(get_string('nostudentsingroup'));
$nostudents = true; $nostudents = true;
$groupstudents = array(); $groupstudents = array();
} }
$allowedlist = array_keys($groupstudents); $allowedlist = array_keys($groupstudents);
unset($groupstudents);
} }


if ( !$nostudents ) { if ( !$nostudents ) {
Expand Down
6 changes: 4 additions & 2 deletions mod/scorm/report/interactions/report.php
Expand Up @@ -96,21 +96,23 @@ function display($scorm, $cm, $course, $download) {


if (empty($currentgroup)) { if (empty($currentgroup)) {
// all users who can attempt scoes // all users who can attempt scoes
if (!$students = get_users_by_capability($contextmodule, 'mod/scorm:savetrack', '', '', '', '', '', '', false)) { if (!$students = get_users_by_capability($contextmodule, 'mod/scorm:savetrack', 'u.id', '', '', '', '', '', false)) {
echo $OUTPUT->notification(get_string('nostudentsyet')); echo $OUTPUT->notification(get_string('nostudentsyet'));
$nostudents = true; $nostudents = true;
$allowedlist = ''; $allowedlist = '';
} else { } else {
$allowedlist = array_keys($students); $allowedlist = array_keys($students);
} }
unset($students);
} else { } else {
// all users who can attempt scoes and who are in the currently selected group // all users who can attempt scoes and who are in the currently selected group
if (!$groupstudents = get_users_by_capability($contextmodule, 'mod/scorm:savetrack', '', '', '', '', $currentgroup, '', false)) { if (!$groupstudents = get_users_by_capability($contextmodule, 'mod/scorm:savetrack', 'u.id', '', '', '', $currentgroup, '', false)) {
echo $OUTPUT->notification(get_string('nostudentsingroup')); echo $OUTPUT->notification(get_string('nostudentsingroup'));
$nostudents = true; $nostudents = true;
$groupstudents = array(); $groupstudents = array();
} }
$allowedlist = array_keys($groupstudents); $allowedlist = array_keys($groupstudents);
unset($groupstudents);
} }
if ( !$nostudents ) { if ( !$nostudents ) {
// Now check if asked download of data // Now check if asked download of data
Expand Down

0 comments on commit 134a6dd

Please sign in to comment.