diff --git a/library/App/RequestNotification.php b/library/App/RequestNotification.php index 33c5843da24cfb937aae96b381740123bc18befd..f3fdb4bdb00b356beeaf624683c9ab19c3ce6715 100644 --- a/library/App/RequestNotification.php +++ b/library/App/RequestNotification.php @@ -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(); }