]> git.mjollnir.org Git - moodle.git/commitdiff
Fix calculation of median with an odd number of attempts.
authortjhunt <tjhunt>
Tue, 29 Jul 2008 13:56:37 +0000 (13:56 +0000)
committertjhunt <tjhunt>
Tue, 29 Jul 2008 13:56:37 +0000 (13:56 +0000)
mod/quiz/report/statistics/report.php

index d2e797070cdabd05b55cfb0290eeb8cbfd1cae4c..fab9d3a889003ac89e8734352b6f732af0570313 100644 (file)
@@ -289,7 +289,7 @@ class quiz_statistics_report extends quiz_default_report {
                 $limitoffset = ($s/2) - 1;
                 $limit = 2;
             } else {
-                $limitoffset = (floor($s/2)) + 1;
+                $limitoffset = (floor($s/2));
                 $limit = 1;
             }
             $sql = 'SELECT id, sumgrades ' .
@@ -372,6 +372,7 @@ class quiz_statistics_report extends quiz_default_report {
 
 }
 function quiz_report_attempts_sql($quizid, $currentgroup, $groupstudents, $allattempts = true){
+    global $DB;
     $fromqa = '{quiz_attempts} qa ';
     $whereqa = 'qa.quiz = :quizid AND qa.preview=0 AND qa.timefinish !=0 ';
     $qaparams = array('quizid'=>$quizid);