From: jamiesensei <jamiesensei>
Date: Thu, 15 May 2008 11:01:23 +0000 (+0000)
Subject: MDL-14844 "Quiz Report: Bar Graph doesn't displayed maximum grade" added perfect... 
X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=a56865318547c8c911253c7ab5436681f5a0eacc;p=moodle.git

MDL-14844 "Quiz Report: Bar Graph doesn't displayed maximum grade" added perfect grade to last  'band' on graph.
---

diff --git a/mod/quiz/report/reportlib.php b/mod/quiz/report/reportlib.php
index f6dd869932..c325abcfff 100644
--- a/mod/quiz/report/reportlib.php
+++ b/mod/quiz/report/reportlib.php
@@ -120,8 +120,13 @@ function quiz_report_grade_bands($bands, $quizid, $useridlist){
     ORDER BY band";
     $data = get_records_sql_menu($sql);
     //need to create array elements with values 0 at indexes where there is no element
-    $data =  $data + array_fill(0, $bands, 0);
+    $data =  $data + array_fill(0, $bands+1, 0);
     ksort($data);
+    //place the maximum (prefect grade) into the last band i.e. make last 
+    //band for example 9 <= g <=10 (where 10 is the perfect grade) rather than
+    //just 9 <= g <10.
+    $data[$bands-1] += $data[$bands];
+    unset($data[$bands]);
     return $data;
 }
 function quiz_report_highlighting_grading_method($quiz, $qmsubselect, $qmfilter){