isFoundationMember()) return false; $elections = $elections_repository->getLatestNElections($latest_elections_qty); if(count($elections) == 0) return false; $elections_id = array(); $latest_election = $elections[0]; $latest_election_id = $latest_election->getIdentifier(); foreach($elections as $election) array_push($elections_id, $election->getIdentifier()); // must not have pending revocation notifications , otherwise, do not sent anything if($member->hasPendingRevocationNotifications($latest_election_id)) return false; return $vote_repository->getVotesCountByMemberAndElections($member->getIdentifier(), $elections_id) < $necessary_votes; } /** * @param int $latest_elections_qty * @param int $necessary_votes * @param IElectionRepository $elections_repository * @param int $offset * @param int $limit * @return bool|string */ public function sql($latest_elections_qty, $necessary_votes, IElectionRepository $elections_repository, $offset, $limit){ $elections = $elections_repository->getLatestNElections($latest_elections_qty); if(count($elections) == 0) return false; $elections_id = array(); $latest_election = $elections[0]; $latest_election_id = $latest_election->getIdentifier(); foreach($elections as $election) array_push($elections_id, $election->getIdentifier()); $elections_id = implode(',',$elections_id); if($latest_election->startDate() == new DateTime('2014-01-13')) { // until January 2014 $sql = <<startDate() > new DateTime('2014-01-13')){ // newer elections -- moving forward for all future elections after Jan. 2015 $early_election = $elections_repository->getEarliestElectionSince(2); $close_date = $early_election->endDate(); $sql = <<