From 06d1324803e7148ff209e01ef8e0fd4bd09ad5a5 Mon Sep 17 00:00:00 2001 From: tjhunt Date: Tue, 29 Jul 2008 13:56:37 +0000 Subject: [PATCH] Fix calculation of median with an odd number of attempts. --- mod/quiz/report/statistics/report.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mod/quiz/report/statistics/report.php b/mod/quiz/report/statistics/report.php index d2e797070c..fab9d3a889 100644 --- a/mod/quiz/report/statistics/report.php +++ b/mod/quiz/report/statistics/report.php @@ -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); -- 2.39.5