From 93943f65706dd2d1985fd9ef13ebca13c145b115 Mon Sep 17 00:00:00 2001 From: michaelpenne Date: Tue, 29 Mar 2005 22:04:06 +0000 Subject: [PATCH] on line 1030, there was a division by zero when a student has not viewed any pages. Now it checks to makes sure $nviewed != 0. This is for the ongoing score feature. --- mod/lesson/locallib.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mod/lesson/locallib.php b/mod/lesson/locallib.php index de4f0a65e2c..3cb74e3ada4 100644 --- a/mod/lesson/locallib.php +++ b/mod/lesson/locallib.php @@ -1027,7 +1027,12 @@ function lesson_calculate_ongoing_score($lesson, $userid, $retries, $return=fals } } $nviewed = count($temp); // this counts number of Questions the user viewed - $thegrade = intval(100 * $ncorrect / $nviewed); + if ($nviewed != 0) { + $thegrade = intval(100 * $ncorrect / $nviewed); + } else { + $thegrade = 0; + } + if ($return) { return $thegrade;