From: James Pratt
Date: Wed, 27 Nov 2013 05:49:19 +0000 (+0700)
Subject: MDL-43079 quiz statistics : fix stats graph when all grades zero
X-Git-Tag: v2.7.0-beta~1003^2
X-Git-Url: http://git.moodle.org/gw?p=moodle.git;a=commitdiff_plain;h=34292e218d455225fb3498c1f5e340298c3b18c4
MDL-43079 quiz statistics : fix stats graph when all grades zero
---
diff --git a/mod/quiz/report/statistics/statistics_graph.php b/mod/quiz/report/statistics/statistics_graph.php
index de6a3f0b00f..9830c0f67c1 100644
--- a/mod/quiz/report/statistics/statistics_graph.php
+++ b/mod/quiz/report/statistics/statistics_graph.php
@@ -146,6 +146,12 @@ foreach ($fieldstoplot as $fieldtoplot => $notused) {
$gridresolution = 10;
$max = ceil($max / $gridresolution) * $gridresolution;
$min = floor($min / $gridresolution) * $gridresolution;
+
+if ($max == $min) {
+ // Make sure there is some difference between min and max y values.
+ $max = $min + $gridresolution;
+}
+
$gridlines = ceil(($max - $min) / $gridresolution) + 1;
$graph->parameter['y_axis_gridlines'] = $gridlines;