Fixed a division by zero error

This commit is contained in:
moodler 2005-04-27 13:54:44 +00:00
parent 253e647478
commit f64fdf3f9d

View File

@ -298,7 +298,11 @@ class block_quiz_results extends block_base {
break;
default:
case GRADE_FORMAT_PCT:
$this->content->text .= round((float)$grades[$gradeid]->grade / (float)$quiz->grade * 100).'%';
if ($quiz->grade) {
$this->content->text .= round((float)$grades[$gradeid]->grade / (float)$quiz->grade * 100).'%';
} else {
$this->content->text .= '--%';
}
break;
}
$this->content->text .= '</td></tr>';