quiz reports MDL-22257: was loading the complete user record, when it only wanted userid.

On a coures with 16000 users, that is a very bad idea ;-)
This commit is contained in:
Tim Hunt
2010-04-30 13:15:42 +00:00
parent 80de705fcb
commit 37b5b69f2e
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -34,7 +34,7 @@ class quiz_overview_report extends quiz_default_report {
/// 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);
@@ -46,7 +46,7 @@ class quiz_overview_report extends quiz_default_report {
$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);
+2 -2
View File
@@ -90,7 +90,7 @@ class quiz_responses_report extends quiz_default_report {
$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);
@@ -102,7 +102,7 @@ class quiz_responses_report extends quiz_default_report {
$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);