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.

This commit is contained in:
michaelpenne
2005-03-29 22:04:06 +00:00
parent 143211e5da
commit 93943f6570
+6 -1
View File
@@ -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;