]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-14209 "quiz stats report:Seperation of functionality and unit tests for calculati...
authorjamiesensei <jamiesensei>
Wed, 29 Oct 2008 10:00:44 +0000 (10:00 +0000)
committerjamiesensei <jamiesensei>
Wed, 29 Oct 2008 10:00:44 +0000 (10:00 +0000)
mod/quiz/report/statistics/qstats.php
mod/quiz/report/statistics/report.php

index 4f00b88223ef0286cc0156fd52a336a5d117c205..7e6253cdedc6439a30a46b1b93b77a01139a9dd9 100644 (file)
@@ -94,7 +94,6 @@ class qstats{
         } else {
             $question =& $this->questions[$stats->questionid];
         }
-        $this->_process_actual_responses($question, $state);
 
     }
 
@@ -269,6 +268,18 @@ class qstats{
                 $this->questions[$qid]->_stats->effectiveweight = null;
             }
         }
+    }
+    
+    function process_responses(){
+        foreach ($this->states as $state){
+            if ($this->questions[$state->question]->qtype == 'random'){
+                if ($realstate = question_get_real_state($state)){
+                    $this->_process_actual_responses($this->subquestions[$realstate->question], $realstate);
+                }
+            } else {
+                $this->_process_actual_responses($this->questions[$state->question], $state);
+            }
+        }
         $this->responses = quiz_report_unindex($this->responses);
     }
     /**
index c5413f2b87820a63aa8f6de90439e6b3cd1b427d..5e2322223e9bf157d9e135d0c9c1f5786714a260 100644 (file)
@@ -565,6 +565,7 @@ class quiz_statistics_report extends quiz_default_report {
             $qstats = new qstats($questions, $s, $sumgradesavg);
             $qstats->get_records($quizid, $currentgroup, $groupstudents, $useallattempts);
             $qstats->process_states();
+            $qstats->process_responses();
         } else {
             $qstats = false;
         }