diff --git a/app/Livewire/BoardDispatcher.php b/app/Livewire/BoardDispatcher.php index 3c6eb70c..8c04f262 100644 --- a/app/Livewire/BoardDispatcher.php +++ b/app/Livewire/BoardDispatcher.php @@ -484,6 +484,25 @@ class BoardDispatcher extends Component implements HasActions, HasSchemas, HasTa $player_totals = SofaScorePlayerPerSeason::with('details')->where('season', 'total')->where('ss_team_id', $team_id)->get(); + /*** + "id" => 35067 + "ss_player_id" => 233856 + "ss_team_id" => 3212 + "season" => "total" + "total_events" => 12 + "total_min" => 667 + "average_min" => 56 + "events_played_home" => 7 + "events_played_away" => 0 + "minutes_played_home" => 398 + "minutes_played_away" => 274 + "goals" => 0 + "fouls" => 5 + "cards" => 2 + "offsides" => 0 + "shots_on_target" => 1 + "shots_off_target" => 0 + */ $results = []; foreach ($player_totals as $val) { if ($val->details && $val->details->is_active) { @@ -516,12 +535,11 @@ class BoardDispatcher extends Component implements HasActions, HasSchemas, HasTa $tmp['somma_goals'] = $val->goals; // Somma Minuti Giocati da Player (SMG) nel DB - $somma_minuti = $val->minutes_played_home + $val->minutes_played_away; - $tmp['somma_minuti'] = $somma_minuti; + $tmp['somma_minuti'] = $val->total_min; // Aspettativa di Gioco // (AdG) - $asp_gioco = $somma_goals / $somma_minuti * 90; + $asp_gioco = $val->goals / $val->total_min * 90; $tmp['asp_gioco'] = $asp_gioco; // il valore corrispondente al ruolo del Player (esempio un giocatore in Details ha ruolo = RW @@ -537,10 +555,12 @@ class BoardDispatcher extends Component implements HasActions, HasSchemas, HasTa $bettypes = ['goals', 'cards', 'fouls', 'offsides', 'total_shots', 'shots_on_target']; foreach ($bettypes as $bettype) { + $asp_statistica = (float) SofaScorePlayerPosition::where('ss_code', $position)->value('exp_'.$bettype); + $tmp['asp_statistica_'.$bettype] = $asp_statistica; - if ($somma_minuti < $this->y_value) { + if ($val->total_min < $this->y_value) { // Se la SMG รจ < Y per quel Player prenderemo in considerazione solo l'Aspettativa Statistica (AS). $tmp['asp_teorica_'.$bettype] = $asp_statistica; } else { @@ -551,11 +571,10 @@ class BoardDispatcher extends Component implements HasActions, HasSchemas, HasTa $tmp['asp_teorica_'.$bettype] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value); } } - // Calcolare la Somma di tutte le AT (colonna G della Tabella) // Considerare la ATR calcolata allo Step 1 (colonna I della Tabella) - // Aspettativa per Player: AP = AT * ATR / TOT AT + $results[] = $tmp; } }