Skip to content

Commit

Permalink
Fix #766 - prevent fatal error when maxscore is zero.
Browse files Browse the repository at this point in the history
  • Loading branch information
danmarsden committed Sep 16, 2024
1 parent 1ff1f7c commit aedbe9c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions classes/output/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -1742,7 +1742,7 @@ private function construct_user_allsessions_log(user_data $userdata) {
}

$row = new html_table_row();
if ($maxpoints !== 0) {
if (!empty($maxpoints)) {
$pctodate = format_float( $points * 100 / $maxpoints);
$pointsinfo = get_string('points', 'attendance') . ": " . $points . "/" . $maxpoints;
$pointsinfo .= " (" . $pctodate . "%)";
Expand Down Expand Up @@ -1829,7 +1829,7 @@ private function construct_user_allsessions_log(user_data $userdata) {
$row->cells[] = $cell;
$points = $stats['course'][$sess->courseid]['points'];
$maxpoints = $stats['course'][$sess->courseid]['maxpointstodate'];
if ($maxpoints !== 0) {
if (!empty($maxpoints)) {
$pctodate = format_float( $points * 100 / $maxpoints);
$summary = get_string('points', 'attendance') . ": " . $points . "/" . $maxpoints;
$summary .= " (" . $pctodate . "%)";
Expand Down

0 comments on commit aedbe9c

Please sign in to comment.