Example #1
0
 public static function GetNEmpateDoTime($id)
 {
     $pontos = 0;
     $model = new Confronto();
     $model = Confronto::find()->where(['=', 'id_time_casa', $id])->andWhere(['=', 'id_time_visitante', $id])->andWhere(['=', 'empate', 1])->all();
     foreach ($model as $ponto) {
         $pontos = $pontos + 1;
     }
     return $pontos;
 }
Example #2
0
 /**
  * Finds the Confronto model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Confronto the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Confronto::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Example #3
0
 public static function GetPorcentagemApostaVisitante($id)
 {
     $apostasCasa = Confronto::GetNumeroApostaCasa($id);
     $apostasVisitante = Confronto::GetNumeroApostaVisitante($id);
     $total = 0;
     if ($apostasCasa != 0 && $apostasVisitante != 0) {
         $total = $apostasVisitante / ($apostasCasa + $apostasVisitante) * 100;
     } else {
         if ($apostasCasa == 0 && $apostasVisitante != 0) {
             $total = 100;
         }
     }
     return $total;
 }
Example #4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdConfronto()
 {
     return $this->hasOne(Confronto::className(), ['id' => 'id_confronto']);
 }
Example #5
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getConfrontos1()
 {
     return $this->hasMany(Confronto::className(), ['vencedor' => 'id']);
 }
Example #6
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getConfrontos()
 {
     return $this->hasMany(Confronto::className(), ['id_grupo' => 'id']);
 }