mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
MDL-9137 Fixing errors in the overview report
This commit is contained in:
parent
a8bb516dce
commit
bc430af20d
5 changed files with 14 additions and 9 deletions
|
@ -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 = ' - ';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue