diff --git a/mod/quiz/report/overview/report.php b/mod/quiz/report/overview/report.php index 7a9b5e14577..b9b5d83f12a 100644 --- a/mod/quiz/report/overview/report.php +++ b/mod/quiz/report/overview/report.php @@ -202,18 +202,25 @@ class quiz_overview_report extends quiz_default_report { 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 ';