Fix Bug #830: Negative assurance points
authorMichael Tänzer <neo@nhng.de>
Tue, 3 Aug 2010 19:19:05 +0000 (21:19 +0200)
committerMichael Tänzer <neo@nhng.de>
Tue, 3 Aug 2010 19:19:05 +0000 (21:19 +0200)
If the user had more than 100 points adding more points through an
automated assurance resulted in negative points

Signed-off-by: Michael Tänzer <neo@nhng.de>
manager/application/controllers/ManageAccountController.php

index 33eed81..e900d72 100644 (file)
@@ -91,6 +91,11 @@ class ManageAccountController extends Zend_Controller_Action
                 $assurance['points'] = $assurance['awarded'];
             }
             
                 $assurance['points'] = $assurance['awarded'];
             }
             
+            // Only assign positive amounts
+            if ($assurance['points'] < 0){
+                $assurance['points'] = 0;
+            }
+            
             $this->db->insert('notary', $assurance);
             
             $user['points'] += $assurance['points'];
             $this->db->insert('notary', $assurance);
             
             $user['points'] += $assurance['points'];