From 34292e218d455225fb3498c1f5e340298c3b18c4 Mon Sep 17 00:00:00 2001 From: James Pratt Date: Wed, 27 Nov 2013 12:49:19 +0700 Subject: [PATCH] MDL-43079 quiz statistics : fix stats graph when all grades zero --- mod/quiz/report/statistics/statistics_graph.php | 6 ++++++ 1 file changed, 6 insertions(+) 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; -- 2.43.0