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.
This commit is contained in:
Tim Hunt
2011-02-18 14:10:04 +00:00
parent 99faefb29b
commit bbc2d0ba31
+16 -9
View File
@@ -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 ';