diff --git a/app/Filament/Widgets/PlayerPropsDrop.php b/app/Filament/Widgets/PlayerPropsDrop.php index d2e35791..1dffa308 100644 --- a/app/Filament/Widgets/PlayerPropsDrop.php +++ b/app/Filament/Widgets/PlayerPropsDrop.php @@ -16,6 +16,9 @@ use Filament\Widgets\Widget; use Illuminate\Support\Facades\Auth; use Livewire\Attributes\On; +/** + * --- Aspettativa di Gioco (AdG) = Somma Goals fatti da Player nel DB / Somma Minuti Giocati da Player (SMG) nel DB * 90. Se la SMG รจ < Y per quel Player prenderemo in considerazione solo l'Aspettativa Statistica (AS). Il valore Y dovrebbe essere configurabile in una interfaccia. Il valore iniziale lo fissiamo a Y = 180 + */ class PlayerPropsDrop extends Widget { protected string $view = 'livewire.player-props-drop'; @@ -367,6 +370,16 @@ class PlayerPropsDrop extends Widget foreach ($player_totals as $val) { if ($val->details != null && $val->details->position != 'GK' && (int) $val->details->is_active != 0) { + /*** + "goals" => 0 + "fouls" => 13 + "cards" => 3 + "offsides" => 0 + "shots_on_target" => 3 + "shots_off_target" => 2 + "total_shots" => 4 + */ + $ss_player_id = $val->ss_player_id; $position = $val->details->position; @@ -416,64 +429,58 @@ class PlayerPropsDrop extends Widget switch ($bettype) { case 'goals': - if ($val->total_min < $this->y_value || $val->goals == 0) { - $tmp['asp_gioco_'.$bettype] = $asp_statistica; - $tmp['asp_teorica_'.$bettype] = $asp_statistica; + if ($val->goals < $this->y_value) { + $asp_gioco = $asp_statistica; } else { $asp_gioco = $val->goals / $val->total_min * 90; - $tmp['asp_gioco_'.$bettype] = $asp_gioco; - $tmp['asp_teorica_'.$bettype] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value); } + $tmp['asp_gioco_'.$bettype] = $asp_gioco; + $tmp['asp_teorica_'.$bettype] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value); break; case 'cards': - if ($val->total_min < $this->y_value || $val->cards == 0) { - $tmp['asp_gioco_'.$bettype] = $asp_statistica; - $tmp['asp_teorica_'.$bettype] = $asp_statistica; + if ($val->cards < $this->y_value) { + $asp_gioco = $asp_statistica; } else { $asp_gioco = $val->cards / $val->total_min * 90; - $tmp['asp_gioco_'.$bettype] = $asp_gioco; - $tmp['asp_teorica_'.$bettype] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value); } + $tmp['asp_gioco_'.$bettype] = $asp_gioco; + $tmp['asp_teorica_'.$bettype] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value); break; case 'fouls': - if ($val->total_min < $this->y_value || $val->fouls == 0) { - $tmp['asp_gioco_'.$bettype] = $asp_statistica; - $tmp['asp_teorica_'.$bettype] = $asp_statistica; + if ($val->fouls < $this->y_value) { + $asp_gioco = $asp_statistica; } else { $asp_gioco = $val->fouls / $val->total_min * 90; - $tmp['asp_gioco_'.$bettype] = $asp_gioco; - $tmp['asp_teorica_'.$bettype] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value); } + $tmp['asp_gioco_'.$bettype] = $asp_gioco; + $tmp['asp_teorica_'.$bettype] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value); break; case 'offsides': - if ($val->total_min < $this->y_value || $val->offsides == 0) { - $tmp['asp_gioco_'.$bettype] = $asp_statistica; - $tmp['asp_teorica_'.$bettype] = $asp_statistica; + if ($val->offsides < $this->y_value) { + $asp_gioco = $asp_statistica; } else { $asp_gioco = $val->offsides / $val->total_min * 90; - $tmp['asp_gioco_'.$bettype] = $asp_gioco; - $tmp['asp_teorica_'.$bettype] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value); } + $tmp['asp_gioco_'.$bettype] = $asp_gioco; + $tmp['asp_teorica_'.$bettype] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value); break; case 'total_shots': - if ($val->total_min < $this->y_value || $val->total_shots == 0) { - $tmp['asp_gioco_'.$bettype] = $asp_statistica; - $tmp['asp_teorica_'.$bettype] = $asp_statistica; + if ($val->total_shots < $this->y_value) { + $asp_gioco = $asp_statistica; } else { $asp_gioco = $val->total_shots / $val->total_min * 90; - $tmp['asp_gioco_'.$bettype] = $asp_gioco; - $tmp['asp_teorica_'.$bettype] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value); } + $tmp['asp_gioco_'.$bettype] = $asp_gioco; + $tmp['asp_teorica_'.$bettype] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value); break; case 'shots_on_target': - if ($val->total_min < $this->y_value || $val->shots_on_target == 0) { - $tmp['asp_gioco_'.$bettype] = $asp_statistica; - $tmp['asp_teorica_'.$bettype] = $asp_statistica; + if ($val->shots_on_target < $this->y_value) { + $asp_gioco = $asp_statistica; } else { $asp_gioco = $val->shots_on_target / $val->total_min * 90; - $tmp['asp_gioco_'.$bettype] = $asp_gioco; - $tmp['asp_teorica_'.$bettype] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value); } + $tmp['asp_gioco_'.$bettype] = $asp_gioco; + $tmp['asp_teorica_'.$bettype] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value); break; } } @@ -503,39 +510,39 @@ class PlayerPropsDrop extends Widget // $results[$key]['asp_player_'.$bettype] = ($asp_team * $asp_team_riferimento) / $total_bettype; $asp_team_riferimento = (float) $asp_team * $count_player / 10; + $results[$key]['asp_riferimento_goals'] = $asp_team_riferimento; $results[$key]['asp_total_'.$bettype] = $total_bettype; $results[$key]['asp_player_'.$bettype] = $value['asp_teorica_'.$bettype] * $asp_team_riferimento / $total_bettype; - $results[$key]['asp_riferimento_goals'] = $asp_team_riferimento; break; case 'cards': $asp_team_riferimento = (float) $asp_team_all['crd'][$team_home_away] * $count_player / 10; + $results[$key]['asp_team_riferimento_card'] = $asp_team_riferimento; $results[$key]['asp_player_'.$bettype] = $value['asp_teorica_'.$bettype] * $asp_team_riferimento / $total_bettype; $results[$key]['asp_total_'.$bettype] = $total_bettype; - $results[$key]['asp_team_riferimento_card'] = $asp_team_riferimento; break; case 'fouls': $asp_team_riferimento = (float) $asp_team_all['fls'][$team_home_away] * $count_player / 10; + $results[$key]['asp_team_riferimento_fouls'] = $asp_team_riferimento; $results[$key]['asp_total_'.$bettype] = $total_bettype; $results[$key]['asp_player_'.$bettype] = $value['asp_teorica_'.$bettype] * $asp_team_riferimento / $total_bettype; - $results[$key]['asp_team_riferimento_fouls'] = $asp_team_riferimento; break; case 'offsides': $asp_team_riferimento = (float) $asp_team_all['ofs'][$team_home_away] * $count_player / 10; + $results[$key]['asp_team_riferimento_offside'] = $asp_team_riferimento; $results[$key]['asp_total_'.$bettype] = $total_bettype; $results[$key]['asp_player_'.$bettype] = $value['asp_teorica_'.$bettype] * $asp_team_riferimento / $total_bettype; - $results[$key]['asp_team_riferimento_offside'] = $asp_team_riferimento; break; case 'total_shots': $asp_team_riferimento = (float) $asp_team_all['tsh'][$team_home_away] * $count_player / 10; + $results[$key]['asp_team_riferimento_tsh'] = $asp_team_riferimento; $results[$key]['asp_total_'.$bettype] = $total_bettype; $results[$key]['asp_player_'.$bettype] = $value['asp_teorica_'.$bettype] * $asp_team_riferimento / $total_bettype; - $results[$key]['asp_team_riferimento_tsh'] = $asp_team_riferimento; break; case 'shots_on_target': $asp_team_riferimento = (float) $asp_team_all['snt'][$team_home_away] * $count_player / 10; + $results[$key]['asp_team_riferimento_snt'] = $asp_team_riferimento; $results[$key]['asp_total_'.$bettype] = $total_bettype; $results[$key]['asp_player_'.$bettype] = $value['asp_teorica_'.$bettype] * $asp_team_riferimento / $total_bettype; - $results[$key]['asp_team_riferimento_snt'] = $asp_team_riferimento; break; } }