bug 1391: fix sql statement
authorBenny Baumann <BenBE@geshi.org>
Fri, 31 Jul 2015 06:04:11 +0000 (08:04 +0200)
committerBenny Baumann <BenBE@geshi.org>
Fri, 31 Jul 2015 06:05:00 +0000 (08:05 +0200)
manager/application/models/User.php

index 53711f9..f8ebf60 100644 (file)
@@ -108,8 +108,8 @@ class Default_Model_User {
      * user's points
      */
     public function refreshPoints() {
      * user's points
      */
     public function refreshPoints() {
-        $query = "select sum(`points`) as `total` from `notary` " .
-               "where `to` = :user and method != 'Administrative Increase' and from != to";
+        $query = "SELECT SUM(`points`) AS `total` FROM `notary` " .
+            "WHERE `to` = :user AND `method` != 'Administrative Increase' AND `from` != `to`";
         $query_params['user'] = $this->id;
         $row = $this->db->query($query, $query_params)->fetch();
         if ($row['total'] === null) $row['total'] = 0;
         $query_params['user'] = $this->id;
         $row = $this->db->query($query, $query_params)->fetch();
         if ($row['total'] === null) $row['total'] = 0;