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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user