From b32cd8703c16a9fc7089a31765641222b85e18c5 Mon Sep 17 00:00:00 2001 From: Dan Marsden Date: Mon, 18 May 2015 09:55:46 +1200 Subject: [PATCH] Better fix for Fix #72 --- locallib.php | 7 ++++--- renderables.php | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/locallib.php b/locallib.php index b50128c..8a160b9 100644 --- a/locallib.php +++ b/locallib.php @@ -697,7 +697,7 @@ class attendance { return $DB->count_records_select('attendance_sessions', $where, $params); } - public function get_filtered_sessions($filtergroups = true) { + public function get_filtered_sessions() { global $DB; if ($this->pageparams->startdate && $this->pageparams->enddate) { @@ -707,8 +707,9 @@ class attendance { } else { $where = "attendanceid = :aid AND sessdate >= :csdate"; } - if ($filtergroups && $this->pageparams->get_current_sesstype() > att_page_with_filter_controls::SESSTYPE_ALL) { - $where .= " AND groupid=:cgroup"; + + if ($this->pageparams->get_current_sesstype() > att_page_with_filter_controls::SESSTYPE_ALL) { + $where .= " AND (groupid = :cgroup OR groupid = 0)"; } $params = array( 'aid' => $this->id, diff --git a/renderables.php b/renderables.php index 7502859..5dd2223 100644 --- a/renderables.php +++ b/renderables.php @@ -475,7 +475,7 @@ class attendance_report_data implements renderable { $this->groups = groups_get_all_groups($att->course->id); - $this->sessions = $att->get_filtered_sessions(false); + $this->sessions = $att->get_filtered_sessions(); $this->statuses = $att->get_statuses(); $this->allstatuses = $att->get_statuses(false);