From b03d219b2972d98b0bf0b139f482b24f04f04838 Mon Sep 17 00:00:00 2001 From: Dan Marsden Date: Mon, 16 Sep 2024 17:05:42 +1200 Subject: [PATCH] Fix #766 - prevent fatal error when maxscore is zero. --- classes/output/renderer.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/classes/output/renderer.php b/classes/output/renderer.php index b232f9dd0c..e83400a49a 100644 --- a/classes/output/renderer.php +++ b/classes/output/renderer.php @@ -1740,7 +1740,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 . "%)"; @@ -1827,7 +1827,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 . "%)";