From 66174d6fb339cee7014017f10df5d7ce06455382 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20T=C3=A4nzer?= Date: Thu, 29 Apr 2010 21:21:47 +0200 Subject: [PATCH] A new Assurer has to be selected for every single assurance MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michael Tänzer --- manager/application/controllers/AddPointsController.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/manager/application/controllers/AddPointsController.php b/manager/application/controllers/AddPointsController.php index 86557f3..891ee5d 100644 --- a/manager/application/controllers/AddPointsController.php +++ b/manager/application/controllers/AddPointsController.php @@ -57,10 +57,6 @@ class AddPointsController extends Zend_Controller_Action $user['id'] = $row['id']; - // Get the first assurer who didn't already assure the user - $assurer = $this->getNewAssurer($user['id']); - - // Get current points of the user $query = 'select sum(`points`) as `total` from `notary` where `to` = :user'; $query_params['user'] = $user['id']; @@ -71,7 +67,6 @@ class AddPointsController extends Zend_Controller_Action // Do the actual assurances $assurance = array(); // Make sure the array is empty - $assurance['from'] = $assurer; $assurance['to'] = $user['id']; $assurance['location'] = $values['location']; $assurance['date'] = $values['date']; @@ -89,6 +84,9 @@ class AddPointsController extends Zend_Controller_Action $quantity = 0; } + // Get the assurer for this assurance + $assurance['from'] = $this->getNewAssurer($user['id']); + // only assign points whithin the limit if ($user['points'] + $assurance['awarded'] > self::MAX_ASSURANCE_POINTS){ $assurance['points'] = self::MAX_ASSURANCE_POINTS - $user['points'];