Пример #1
0
 /**
  *	Returns the score column corresponding to the competition's post-rule computation.
  *  If there is no 'post-rule', there is not computed score.
  *
  *	@return number	Returns computed total score.
  */
 public function getScoreFromFinalRule()
 {
     $scores = null;
     //		echo 'yep '.$this->registration->competition->finalRule->id.', '; // @bug?
     if ($rule = Rule::findOne($this->registration->competition->final_rule_id)) {
         switch ($rule->destination_type) {
             case self::SCORE_GROSS:
                 $scores = $this->score;
                 break;
             case self::SCORE_NET:
                 $scores = $this->score_net;
                 break;
             case self::SCORE_STABLEFORD:
                 $scores = $this->stableford;
                 break;
             case self::SCORE_STABLEFORD_NET:
                 $scores = $this->stableford_net;
                 break;
             case self::SCORE_TOPAR:
                 $scores = $this->lastToPar();
                 break;
             case self::SCORE_TOPAR_NET:
                 $scores = $this->lastToPar_net();
                 break;
             case self::SCORE_POINTS:
                 $scores = $this->points;
                 break;
         }
     }
     return $scores;
 }
Пример #2
0
 /**
  * Finds the Rule model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Rule the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Rule::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }