From: jamiesensei Date: Fri, 2 May 2008 14:21:33 +0000 (+0000) Subject: MDL-14664 "sorting by question mark when viewing detailled mark in overview quiz... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=e0b01669cedb510936fbae37fbc9731c5d766fe9;p=moodle.git MDL-14664 "sorting by question mark when viewing detailled mark in overview quiz report not working" Found that the problem ocurred when attempt.id != attempt.uniqueid as the sql was using the wrong field to join the question records. --- diff --git a/mod/quiz/report/overview/report.php b/mod/quiz/report/overview/report.php index 66981ed8dd..358e385ce5 100644 --- a/mod/quiz/report/overview/report.php +++ b/mod/quiz/report/overview/report.php @@ -372,11 +372,11 @@ class quiz_report extends quiz_default_report { if(substr($sortpart, 0, 1) == '$') { if(!$questionsort) { $qid = intval(substr($sortpart, 1)); - $select .= ', grade '; - $from .= ' LEFT JOIN '.$CFG->prefix.'question_sessions qns ON qns.attemptid = qa.id '. + $select .= ', qs.grade AS qgrade '; + $from .= ' LEFT JOIN '.$CFG->prefix.'question_sessions qns ON qns.attemptid = qa.uniqueid '. 'LEFT JOIN '.$CFG->prefix.'question_states qs ON qs.id = qns.newgraded '; $where .= ' AND (qns.questionid IS NULL OR qns.questionid = '.$qid.')'; - $newsort[] = 'grade '.(strpos($sortpart, 'ASC')? 'ASC' : 'DESC'); + $newsort[] = 'qgrade '.(strpos($sortpart, 'ASC')? 'ASC' : 'DESC'); $questionsort = true; } } else { @@ -420,7 +420,6 @@ class quiz_report extends quiz_default_report { if (!$download) { $table->initialbars($totalinitials>20); } - if(!empty($attempts) || !empty($noattempts)) { if ($attempts) { foreach ($attempts as $attempt) {