From 5aa9db5f01a1eee28ef7004e2dd3eb7ae1591fdf Mon Sep 17 00:00:00 2001 From: Antonio Carlos Mariani Date: Tue, 3 May 2016 12:04:48 -0300 Subject: [PATCH] Fix export report --- export.php | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/export.php b/export.php index e270487..0a5765c 100644 --- a/export.php +++ b/export.php @@ -123,10 +123,9 @@ if ($formdata = $mform->get_data()) { } else { print_error('sessionsnotfound', 'attendance', $att->url_manage()); } - if ($reportdata->gradable) { - $data->tabhead[] = get_string('grade'); - $data->tabhead[] = get_string('percentage', 'attendance'); - } + $data->tabhead[] = get_string('takensessions', 'attendance'); + $data->tabhead[] = get_string('points', 'attendance'); + $data->tabhead[] = get_string('percentage', 'attendance'); $i = 0; $data->table = array(); @@ -158,16 +157,13 @@ if ($formdata = $mform->get_data()) { } $cellsgenerator = new user_sessions_cells_text_generator($reportdata, $user); $data->table[$i] = array_merge($data->table[$i], $cellsgenerator->get_cells(isset($formdata->includeremarks))); - if ($reportdata->gradable) { - $data->table[$i][] = format_float($reportdata->grades[$user->id]).' / '. - format_float($reportdata->maxgrades[$user->id]); - if ($reportdata->maxgrades[$user->id]) { - $percent = $reportdata->grades[$user->id] * 100.0 / $reportdata->maxgrades[$user->id]; - } else { - $percent = 0.0; - } - $data->table[$i][] = $percent; - } + + $usersummary = $reportdata->summary->get_taken_sessions_summary_for($user->id); + $data->table[$i][] = $usersummary->numtakensessions; + $data->table[$i][] = attendance_format_float($usersummary->takensessionspoints) . ' / ' . + attendance_format_float($usersummary->takensessionsmaxpoints); + $data->table[$i][] = attendance_format_float($usersummary->takensessionspercentage * 100, false); + $i++; }