From 6af7859ad677d1377fde82ea094962c05b1b39c1 Mon Sep 17 00:00:00 2001
From: Thomas Wedekind <thomas.wedekind@univie.ac.at>
Date: Wed, 14 Aug 2024 14:13:20 +0200
Subject: [PATCH] fix #111: statistics tab not working under postgres

---
 model/pdfannotator.php     | 1 +
 model/statistics.class.php | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/model/pdfannotator.php b/model/pdfannotator.php
index 2850d04..229c0be 100644
--- a/model/pdfannotator.php
+++ b/model/pdfannotator.php
@@ -37,6 +37,7 @@ class pdfannotator_instance {
     private $reports;
     private $hiddenanswers;
     private $hiddenreports;
+    private $userposts;
 
     public function __construct($dbrecord) {
         $this->id = $dbrecord->id;
diff --git a/model/statistics.class.php b/model/statistics.class.php
index dc7bebf..fd5d904 100644
--- a/model/statistics.class.php
+++ b/model/statistics.class.php
@@ -99,7 +99,7 @@ public function get_comments_average_course($isquestion) {
         $sql = "SELECT AVG(count) AS average FROM ("
                 . "SELECT COUNT(*) AS count "
                 . "FROM {pdfannotator_comments} c, {pdfannotator} a "
-                . "WHERE a.course = ? AND a.id = c.pdfannotatorid AND c.isquestion = ? AND c.isdeleted = ?"
+                . "WHERE a.course = ? AND a.id = c.pdfannotatorid AND c.isquestion = ? AND c.isdeleted = ? "
                 . "GROUP BY c.userid ) AS counts";
 
         return (float) key($DB->get_records_sql($sql, array($this->courseid, $isquestion, '0')));