When using "sum of grades" and $grademax is zero, a division by zero
error occurs in fill_contributions_column() in
grade/report/user/lib.php.
if ($gradecat->aggregation == GRADE_AGGREGATE_SUM) {
// Natural aggregation/Sum of grades does not consider the mingrade, cannot traditionnally normalise it.
$graderange = $this->aggregationhints[$itemid]['grademax'];
- $gradeval = $this->aggregationhints[$itemid]['grade'] / $graderange;
+
+ if ($graderange != 0) {
+ $gradeval = $this->aggregationhints[$itemid]['grade'] / $graderange;
+ } else {
+ $gradeval = 0;
+ }
} else {
$gradeval = grade_grade::standardise_score($this->aggregationhints[$itemid]['grade'],
$this->aggregationhints[$itemid]['grademin'], $this->aggregationhints[$itemid]['grademax'], 0, 1);