コード例 #1
0
 /**
  * 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;
 }