Exemple #1
0
 /**
  * Whether a competition has started and has scores registered.
  *
  * @return boolean
  */
 public function hasScores()
 {
     // does this competition has score?
     foreach ($this->getRegistrations()->andWhere(['status' => Registration::getParticipantStatuses()])->each() as $registration) {
         if ($registration->hasScore()) {
             return true;
         }
     }
     // if not, does a "child" competition have score?
     foreach ($this->getCompetitions()->each() as $competition) {
         if ($competition->hasScores()) {
             return true;
         }
     }
     return false;
 }