Skip to content

Commit

Permalink
quiz reports MDL-22257: was loading the complete user record, when it…
Browse files Browse the repository at this point in the history
… only wanted userid.

On a coures with 16000 users, that is a very bad idea ;-)
  • Loading branch information
timhunt committed Apr 30, 2010
1 parent 80de705 commit 37b5b69
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions mod/quiz/report/overview/report.php
Expand Up @@ -34,7 +34,7 @@ function display($quiz, $cm, $course) {

/// find out current groups mode
$currentgroup = groups_get_activity_group($cm, true);
if (!$students = get_users_by_capability($this->context, array('mod/quiz:reviewmyattempts', 'mod/quiz:attempt'),'','','','','','',false)){
if (!$students = get_users_by_capability($this->context, array('mod/quiz:reviewmyattempts', 'mod/quiz:attempt'),'id,1','','','','','',false)){
$students = array();
} else {
$students = array_keys($students);
Expand All @@ -46,7 +46,7 @@ function display($quiz, $cm, $course) {
$groupstudents = array();
} else {
// all users who can attempt quizzes and who are in the currently selected group
if (!$groupstudents = get_users_by_capability($this->context, array('mod/quiz:reviewmyattempts', 'mod/quiz:attempt'),'','','','',$currentgroup,'',false)){
if (!$groupstudents = get_users_by_capability($this->context, array('mod/quiz:reviewmyattempts', 'mod/quiz:attempt'),'id,1','','','',$currentgroup,'',false)){
$groupstudents = array();
} else {
$groupstudents = array_keys($groupstudents);
Expand Down
4 changes: 2 additions & 2 deletions mod/quiz/report/responses/report.php
Expand Up @@ -90,7 +90,7 @@ function display($quiz, $cm, $course) {
$displayoptions['qmfilter'] = $qmfilter;

//work out the sql for this table.
if (!$students = get_users_by_capability($context, array('mod/quiz:reviewmyattempts', 'mod/quiz:attempt'),'','','','','','',false)){
if (!$students = get_users_by_capability($context, array('mod/quiz:reviewmyattempts', 'mod/quiz:attempt'),'id,1','','','','','',false)){
$students = array();
} else {
$students = array_keys($students);
Expand All @@ -102,7 +102,7 @@ function display($quiz, $cm, $course) {
$groupstudents = array();
} else {
// all users who can attempt quizzes and who are in the currently selected group
if (!$groupstudents = get_users_by_capability($context, array('mod/quiz:reviewmyattempts', 'mod/quiz:attempt'),'','','','',$currentgroup,'',false)){
if (!$groupstudents = get_users_by_capability($context, array('mod/quiz:reviewmyattempts', 'mod/quiz:attempt'),'id,1','','','',$currentgroup,'',false)){
$groupstudents = array();
} else {
$groupstudents = array_keys($groupstudents);
Expand Down

0 comments on commit 37b5b69

Please sign in to comment.