MDL-9137 Fixing errors in the overview report

This commit is contained in:
nicolasconnault 2007-08-10 14:58:21 +00:00
parent a8bb516dce
commit bc430af20d
5 changed files with 14 additions and 9 deletions

View file

@ -117,7 +117,12 @@ foreach ($report_info as $outcomeid => $outcomedata) {
// Calculate outcome average
if (is_array($outcomedata['items'])) {
$avg = $outcomedata['outcome']->sum / count($outcomedata['items']);
$count = count($outcomedata['items']);
if ($count > 0) {
$avg = $outcomedata['outcome']->sum / $count;
} else {
$avg = $outcomedata['outcome']->sum;
}
$avg_html = $scale->get_nearest_item($avg) . " (" . round($avg, 2) . ")\n";
} else {
$avg_html = ' - ';