Better fix for Fix #72
authorDan Marsden <dan@danmarsden.com>
Sun, 17 May 2015 21:55:46 +0000 (09:55 +1200)
committerDan Marsden <dan@danmarsden.com>
Sun, 17 May 2015 21:55:46 +0000 (09:55 +1200)
locallib.php
renderables.php

index b50128c..8a160b9 100644 (file)
@@ -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,
index 7502859..5dd2223 100644 (file)
@@ -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);