MDL-28612 Quiz statistics report does not always show the 'Actual response' column...
authorTim Hunt <T.J.Hunt@open.ac.uk>
Thu, 4 Aug 2011 17:13:29 +0000 (18:13 +0100)
committerTim Hunt <T.J.Hunt@open.ac.uk>
Thu, 4 Aug 2011 17:14:31 +0000 (18:14 +0100)
mod/quiz/report/statistics/responseanalysis.php
question/type/questionbase.php

index 3aa9022..1c030f4 100644 (file)
@@ -98,12 +98,18 @@ class quiz_statistics_response_analyser {
 
     /**
      * @return bool whether this analysis has a response class more than one
-     *      different acutal response.
+     *      different acutal response, or if the actual response is different from
+     *      the model response.
      */
     public function has_actual_responses() {
         foreach ($this->responseclasses as $subpartid => $partclasses) {
-            foreach ($partclasses as $responseclassid => $notused) {
-                if (count($this->responses[$subpartid][$responseclassid]) > 1) {
+            foreach ($partclasses as $responseclassid => $modelresponse) {
+                $numresponses = count($this->responses[$subpartid][$responseclassid]);
+                if ($numresponses > 1) {
+                    return true;
+                }
+                $actualresponse = key($this->responses[$subpartid][$responseclassid]);
+                if ($numresponses == 1 && $actualresponse != $modelresponse->responseclass) {
                     return true;
                 }
             }
index f45bf40..edd9266 100644 (file)
@@ -454,7 +454,7 @@ class question_classified_response {
     }
 
     public static function no_response() {
-        return new question_classified_response(null, null, null);
+        return new question_classified_response(null, get_string('noresponse', 'question'), null);
     }
 }