Permalink
Browse files

MDL-43079 quiz statistics : fix stats graph when all grades zero

  • Loading branch information...
1 parent cb891e5 commit 7ef639c709b122be34a2792c510cf94fcd57eb50 @jamiepratt jamiepratt committed with stronk7 Nov 27, 2013
Showing with 6 additions and 0 deletions.
  1. +6 −0 mod/quiz/report/statistics/statistics_graph.php
@@ -146,6 +146,12 @@
$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;

0 comments on commit 7ef639c

Please sign in to comment.