From 2018fb15ae94af97b06c57504406b097b319e925 Mon Sep 17 00:00:00 2001 From: jamiesensei Date: Wed, 30 Apr 2008 08:22:20 +0000 Subject: [PATCH] MDL-7772 "Quiz results overview: not all combinations of Show attempts with ... & Groups settings work properly" Second patch, found a bug while merging and testing in 1.9. --- mod/quiz/report/overview/report.php | 34 ++++++++++++----------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/mod/quiz/report/overview/report.php b/mod/quiz/report/overview/report.php index 9e0b1fa8d0..650b58e9fc 100644 --- a/mod/quiz/report/overview/report.php +++ b/mod/quiz/report/overview/report.php @@ -305,15 +305,18 @@ class quiz_report extends quiz_default_report { echo $headers." \n"; } - // Get users with quiz attempt capability - if (empty($currentgroup)) { - - // all users who can attempt quizzes - $allowed = join(',',array_keys(get_users_by_capability($context, 'mod/quiz:attempt','','','','','','',false))); - } else { - - // all users who can attempt quizzes and who are in the currently selected group - $allowed = join(',',array_keys(get_users_by_capability($context, 'mod/quiz:attempt','','','','',$currentgroup,'',false))); + // Get users with quiz attempt capability 'students'. + // don't need to do this expensive call if we are listing all attempts though. + if ( $noattempts != 3 ) { + if (empty($currentgroup)) { + + // all users who can attempt quizzes + $allowed = join(',',array_keys(get_users_by_capability($context, 'mod/quiz:attempt','','','','','','',false))); + } else { + + // all users who can attempt quizzes and who are in the currently selected group + $allowed = join(',',array_keys(get_users_by_capability($context, 'mod/quiz:attempt','','','','',$currentgroup,'',false))); + } } // Construct the SQL @@ -424,17 +427,8 @@ class quiz_report extends quiz_default_report { $picture = print_user_picture($attempt->userid, $course->id, $attempt->picture, false, true); - // If we're showing all attempts, check to see if user still has the quiz attempt capability - if ( $noattempts == 3 ) { - - $userlink = ''.fullname($attempt).''; - } - else { - - $userlink = ''.fullname($attempt).''; - } + $userlink = ''.fullname($attempt).''; // Username columns. $row = array(); -- 2.39.5