Skip to content
Snippets Groups Projects
Commit 4205ca14 authored by Tim Steiner's avatar Tim Steiner
Browse files

When a request is sent to the same ApprovalActionVote again, be sure that we...

When a request is sent to the same ApprovalActionVote again, be sure that we treat any old votes as pre-votes and only tally new votes.
parent 9ba33291
No related branches found
No related tags found
No related merge requests found
......@@ -80,9 +80,9 @@ class Requests_IndexController extends App_Controller_Action
if ($requestVotes[$requestId] instanceof Requests_ApproverVoteModel) {
$request['vote'] = $requestVotes[$requestId];
}
$histories = $requestHistories[$requestId];
$histories->orderBy('getTime', SORT_DESC);
$request['lastApprovalTime'] = new Zend_Date(0);
$histories = $requestHistories[$requestId];
$histories->orderBy('getUnixtime', SORT_DESC);
foreach ($histories as $history) {
$request['lastApprovalTime'] = $history->getTime();
break;
......@@ -128,9 +128,9 @@ class Requests_IndexController extends App_Controller_Action
if ($requestVotes[$requestId] instanceof Requests_ApproverVoteModel) {
$request['vote'] = $requestVotes[$requestId];
}
$request['lastApprovalTime'] = new Zend_Date(0);
$histories = $requestHistories[$requestId];
$histories->orderBy('getTime', SORT_DESC);
$request['lastApprovalTime'] = new Zend_Date(0);
$histories->orderBy('getUnixtime', SORT_DESC);
foreach ($histories as $history) {
$request['lastApprovalTime'] = $history->getTime();
break;
......
......@@ -81,7 +81,7 @@ class Requests_ApprovalActionQueueModel extends Requests_ApprovalActionModel
$requestHistories = Requests_ApprovalHistoryModel::findByRequest($requests);
foreach ($requests as $request) {
$histories = $requestHistories[$request->getId()];
$histories->orderBy('getTime', SORT_DESC);
$histories->orderBy('getUnixtime', SORT_DESC);
$lastEndTime = new Zend_Date(0);
foreach ($histories as $history) {
if ($history->getApprovalAction() == $this->getId()) {
......
......@@ -63,7 +63,7 @@ class Requests_ApprovalActionVoteModel extends Requests_ApprovalActionQueueModel
$histories = $requestHistories[$request->getId()];
$histories->orderBy('getTime', SORT_DESC);
$histories->orderBy('getUnixtime', SORT_DESC);
$lastEndTime = new Zend_Date(0);
foreach ($histories as $history) {
if ($history->getApprovalAction() == $this->getId()) {
......
......@@ -283,6 +283,11 @@ class Requests_ApprovalHistoryModel extends Unl_Model
return $time;
}
public function getUnixtime()
{
return $this->_data['time'];
}
/**
* Sets the date the comment was posted
*
......
......@@ -223,6 +223,11 @@ class Requests_ApproverVoteModel extends Unl_Model
{
return new Zend_Date($this->_data['time']);
}
public function getUnixtime()
{
return $this->_data['time'];
}
public function setTime(Zend_Date $time)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment