From 7239b831f830eb8f3f40603e3beb7d78d952496c Mon Sep 17 00:00:00 2001 From: INOPIAE Date: Fri, 31 Jul 2015 08:26:12 +0200 Subject: [PATCH] bug 1391: added range check for points --- manager/application/models/User.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/manager/application/models/User.php b/manager/application/models/User.php index f8ebf60..83857ca 100644 --- a/manager/application/models/User.php +++ b/manager/application/models/User.php @@ -115,6 +115,19 @@ class Default_Model_User { if ($row['total'] === null) $row['total'] = 0; $this->points = $row['total']; + + if($this->points < 100) return; + + $this->points = 100; + + $query = "SELECT COUNT(`points`) AS `total` FROM `notary` " . + "WHERE `from` = :user AND `method` == 'Face to Face Meeting' AND `from` != `to`"; + $query_params['user'] = $this->id; + $row = $this->db->query($query, $query_params)->fetch(); + if ($row['total'] === null) $row['total'] = 0; + + $this->points += ($row['total'] > 25) ? 50 : $row['total']; + } /**