Permalink
Browse files

MDL-26416 quiz overview report, clean up the code before making the r…

…eal bug fix.

Cleaning up the code like this will make the real bug-fix easier to understand.
  • Loading branch information...
1 parent 99faefb commit bbc2d0ba3138c633dc64c6fd34675a0c0ed95436 @timhunt timhunt committed Feb 18, 2011
Showing with 16 additions and 9 deletions.
  1. +16 −9 mod/quiz/report/overview/report.php
@@ -202,18 +202,25 @@ function display($quiz, $cm, $course) {
if (!$nostudents || ($attemptsmode == QUIZ_REPORT_ATTEMPTS_ALL)) {
// Construct the SQL
- $fields = $DB->sql_concat('u.id', '\'#\'', 'COALESCE(qa.attempt, 0)').' AS uniqueid, ';
+ $fields = $DB->sql_concat('u.id', "'#'", 'COALESCE(qa.attempt, 0)') . ' AS uniqueid,';
if ($qmsubselect) {
- $fields .=
- "(CASE " .
- " WHEN $qmsubselect THEN 1" .
- " ELSE 0 " .
- "END) AS gradedattempt, ";
+ $fields .= "\n(CASE WHEN $qmsubselect THEN 1 ELSE 0 END) AS gradedattempt,";
}
- $fields .='qa.uniqueid AS attemptuniqueid, qa.id AS attempt, ' .
- 'u.id AS userid, u.idnumber, u.firstname, u.lastname, u.picture, u.imagealt, u.email, '.
- 'qa.sumgrades, qa.timefinish, qa.timestart, qa.timefinish - qa.timestart AS duration ';
+ $fields .= '
+ qa.uniqueid AS attemptuniqueid,
+ qa.id AS attempt,
+ u.id AS userid,
+ u.idnumber,
+ u.firstname,
+ u.lastname,
+ u.picture,
+ u.imagealt,
+ u.email,
+ qa.sumgrades,
+ qa.timefinish,
+ qa.timestart,
+ qa.timefinish - qa.timestart AS duration';
// This part is the same for all cases - join users and quiz_attempts tables
$from = '{user} u ';

0 comments on commit bbc2d0b

Please sign in to comment.