From d6c6d75e27075ac40da8bd1fba22ae1447ab6415 Mon Sep 17 00:00:00 2001 From: Antonio Carlos Mariani Date: Tue, 3 May 2016 16:28:28 -0300 Subject: [PATCH] Add pair (points/maxpoints) after the acronym in the reports --- classes/structure.php | 2 ++ renderhelpers.php | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/classes/structure.php b/classes/structure.php index f04b0fc..e80ae3f 100644 --- a/classes/structure.php +++ b/classes/structure.php @@ -233,6 +233,7 @@ class mod_attendance_structure { 'edate' => $this->pageparams->enddate, 'cgroup' => $this->pageparams->get_current_sesstype()); $sessions = $DB->get_records_select('attendance_sessions', $where, $params, 'sessdate asc'); + $statussetmaxpoints = attendance_get_statusset_maxpoints($this->get_statuses(true, true)); foreach ($sessions as $sess) { if (empty($sess->description)) { $sess->description = get_string('nodescription', 'attendance'); @@ -240,6 +241,7 @@ class mod_attendance_structure { $sess->description = file_rewrite_pluginfile_urls($sess->description, 'pluginfile.php', $this->context->id, 'mod_attendance', 'session', $sess->id); } + $sess->maxpoints = $statussetmaxpoints[$sess->statusset]; } return $sessions; diff --git a/renderhelpers.php b/renderhelpers.php index 7ae611f..ab1be99 100644 --- a/renderhelpers.php +++ b/renderhelpers.php @@ -49,7 +49,10 @@ class user_sessions_cells_generator { if (array_key_exists($sess->id, $this->reportdata->sessionslog[$this->user->id])) { $statusid = $this->reportdata->sessionslog[$this->user->id][$sess->id]->statusid; if (array_key_exists($statusid, $this->reportdata->statuses)) { - $this->construct_existing_status_cell($this->reportdata->statuses[$statusid]->acronym); + $points = attendance_format_float($this->reportdata->statuses[$statusid]->grade); + $maxpoints = attendance_format_float($sess->maxpoints); + $this->construct_existing_status_cell($this->reportdata->statuses[$statusid]->acronym . + " ({$points}/{$maxpoints})"); } else { $this->construct_hidden_status_cell($this->reportdata->allstatuses[$statusid]->acronym); }