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

When counting requests that need approval for/by a user, pre-votes are no longer counted.

parent e90d2774
No related branches found
No related tags found
No related merge requests found
......@@ -43,7 +43,21 @@ class App_RequestNotification
$myVotes = Requests_ApproverVoteModel::findUsersVotesForRequests($user, $myRequests);
$myRequestCount = count($myRequests);
$myVotedRequests = array();
if (count($myRequests) > 0) {
$myRequestStacks = Requests_StackModel::findForRequests($myRequests);
}
foreach ($myVotes as $myVote) {
if ($myVote->getApprovalAction() != $myRequestStacks[$myVote->getRequest()]->getAction()) {
continue;
}
// THIS IS A HACK TO EXCLUDE PRE-VOTES FROM PREVIOUSLY TABLED VOTES OF THE SAME ACTION.
// IF ANY [VOTING PERIOD/TIME BETWEEN VOTING PERIODS] IS EVER [LONGER/SHORTER] THAN 14 DAYS IT WILL NO LONGER WORK!
if ($myVote->getTime()->getTimestamp() < time() - 60*60*24*14) {
continue;
}
$myVotedRequests[] = $myVote->getRequest();
}
......
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