From bbc2d0ba3138c633dc64c6fd34675a0c0ed95436 Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Fri, 18 Feb 2011 12:31:38 +0000 Subject: [PATCH] MDL-26416 quiz overview report, clean up the code before making the real bug fix. Cleaning up the code like this will make the real bug-fix easier to understand. --- mod/quiz/report/overview/report.php | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) 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 ';