Browse Source

Don't show 0% in user report if no taken sessions.

MOODLE_34_STABLE
Dan Marsden 7 years ago
parent
commit
dbab79b760
  1. 6
      renderer.php

6
renderer.php

@ -961,14 +961,20 @@ class mod_attendance_renderer extends plugin_renderer_base {
'studentid' => $userdata->user->id, 'studentid' => $userdata->user->id,
'view' => ATT_VIEW_ALL)); 'view' => ATT_VIEW_ALL));
$row->cells[] = html_writer::link($attendanceurl, $ca->attname); $row->cells[] = html_writer::link($attendanceurl, $ca->attname);
$usersummary = new stdClass();
if (isset($userdata->summary[$ca->attid])) { if (isset($userdata->summary[$ca->attid])) {
$usersummary = $userdata->summary[$ca->attid]->get_all_sessions_summary_for($userdata->user->id); $usersummary = $userdata->summary[$ca->attid]->get_all_sessions_summary_for($userdata->user->id);
$row->cells[] = $usersummary->numtakensessions; $row->cells[] = $usersummary->numtakensessions;
$row->cells[] = format_float($usersummary->takensessionspoints, 1, true, true) . ' / ' . $row->cells[] = format_float($usersummary->takensessionspoints, 1, true, true) . ' / ' .
format_float($usersummary->takensessionsmaxpoints, 1, true, true); format_float($usersummary->takensessionsmaxpoints, 1, true, true);
if (empty($usersummary->numtakensessions)) {
$row->cells[] = '-';
} else {
$row->cells[] = format_float($usersummary->takensessionspercentage * 100) . '%'; $row->cells[] = format_float($usersummary->takensessionspercentage * 100) . '%';
} }
}
$table->data[] = $row; $table->data[] = $row;
if ($usersummary->numtakensessions > 0) { if ($usersummary->numtakensessions > 0) {
$totalattendance++; $totalattendance++;

Loading…
Cancel
Save