/** * Index action * * @return void */ public function indexAction() { $monthIdentifier = $this->electomatService->getMonthIdentifierLastMonth(); $this->view->assign('numberOfCommits', $this->commitRepository->getCommitsByMonth($monthIdentifier)->count()); $this->view->assign('numberOfActiveRepositories', $this->repositoryRepository->extractTheRepositoriesFromAStackOfCommits($this->commitRepository->getCommitsByMonth($monthIdentifier))->count()); $this->view->assign('numberOfMonitoredRepositories', $this->repositoryRepository->countByIsActive(TRUE)); $this->view->assign('numberOfCommitters', $this->aggregatedDataPerUserRepository->findNumberOfCommittersPerMonth($monthIdentifier)); $this->view->assign('coderOfTheMonthAward', $this->awardRepository->findLatestAwards(1)->getFirst()); $this->view->assign('currentTopicAwards', $this->awardRepository->findCurrentTopicAwards()); }
/** * Checks if a given type of award for a specific month can be elected right now. This * decision bases on two facts: * - check if the award for this month is already given * - check if we have data for this month to vote on * * @param string the type of the award * @param string the month identifier * @return boolean true if the award can be elected, false otherwise */ protected function canAwardBeElected($type, $monthIdentifier) { $this->outputLine('Checking the "%s" award for month %s:', array($type, $monthIdentifier)); // first check if there is an award stored already if ($this->awardRepository->findByMonthAndType($monthIdentifier, $type)->count()) { $this->outputLine('This award has been given already.'); return FALSE; } // check if we have data for this month at all if ($type == 'committerOfTheMonth') { $this->topCommitters = $this->electomat->getAwardsForMonth($monthIdentifier); } else { $this->topCommitters = $this->electomat->getTopicAwardsForMonth($type, $monthIdentifier); } if ($this->topCommitters->count() === 0) { $this->outputLine('Nothing found to elect on, sorry...'); return FALSE; } return TRUE; }
/** * Finds the topic awards (everything that is not the basic committer of the month award) * for the current month. * * @return \TYPO3\Flow\Persistence\QueryResultInterface */ public function findCurrentTopicAwards() { $query = $this->createQuery(); $query->matching($query->logicalAnd($query->equals('month', $this->electomatService->getMonthIdentifierLastMonth()), $query->logicalNot($query->equals('type', 'committerOfTheMonth')))); return $query->execute(); }