]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-14664 "sorting by question mark when viewing detailled mark in overview quiz...
authorjamiesensei <jamiesensei>
Fri, 2 May 2008 14:21:33 +0000 (14:21 +0000)
committerjamiesensei <jamiesensei>
Fri, 2 May 2008 14:21:33 +0000 (14:21 +0000)
mod/quiz/report/overview/report.php

index 66981ed8dd8f499b4dd3d0d3b8fced4b6751ae5b..358e385ce5f01517ef72e76e8f98e026abca7d70 100644 (file)
@@ -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) {