From a56865318547c8c911253c7ab5436681f5a0eacc Mon Sep 17 00:00:00 2001 From: jamiesensei Date: Thu, 15 May 2008 11:01:23 +0000 Subject: [PATCH] MDL-14844 "Quiz Report: Bar Graph doesn't displayed maximum grade" added perfect grade to last 'band' on graph. --- mod/quiz/report/reportlib.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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){ -- 2.39.5