diff --git a/app/Filament/Widgets/PlayerPropsDrop.php b/app/Filament/Widgets/PlayerPropsDrop.php index 9236a87c..cae4eace 100644 --- a/app/Filament/Widgets/PlayerPropsDrop.php +++ b/app/Filament/Widgets/PlayerPropsDrop.php @@ -20,17 +20,29 @@ class PlayerPropsDrop extends Widget protected string $view = 'livewire.player-props-drop'; public float $x_value = 3; + public float $y_value = 180; + public array $activeBoxes; + public array $beschriftung; + public array $lineup; + public array $lineUpMap; + public string $activeLineUp; + public array $boxes; + public string $team_name = ''; + public int $team_id = 0; + public int $match_id; + public int $player_on_field_counter; + public array $calculationVariables; public array $players; @@ -241,6 +253,7 @@ class PlayerPropsDrop extends Widget Notification::make()->title('Needs a calculation first ') ->info() ->send(); + return; } @@ -248,9 +261,9 @@ class PlayerPropsDrop extends Widget foreach ($this->calculationVariables as $row) { if ($copystring == '') { $keys = array_keys($row); - $copystring .= implode(';', $keys) . "\n"; + $copystring .= implode(';', $keys)."\n"; } - $copystring .= implode(';', $row) . "\n"; + $copystring .= implode(';', $row)."\n"; } $this->js("navigator.clipboard.writeText(`$copystring`)"); @@ -266,10 +279,11 @@ class PlayerPropsDrop extends Widget Notification::make()->title('Needs a calculation first ') ->info() ->send(); + return; } $header = ['name', 'foot', 'events', 'average min', 'position', 'on field', 'gls', 'fls', 'ofs', 'snt', 'tsh', 'crd']; - $copystring = implode(';', $header) . "\n"; + $copystring = implode(';', $header)."\n"; foreach ($this->players as $row) { $tmp = []; $tmp[] = $row['name']; @@ -289,7 +303,7 @@ class PlayerPropsDrop extends Widget $tmp[] = $row['tsh']; $tmp[] = $row['crd']; - $copystring .= implode(';', $tmp) . "\n"; + $copystring .= implode(';', $tmp)."\n"; } $this->js("navigator.clipboard.writeText(`$copystring`)"); @@ -333,14 +347,18 @@ class PlayerPropsDrop extends Widget $player = StatistikoDetail::where('ss_team_id', (int) $team_id)->where('is_active', 1)->get(); - // dd($player); + $count_player = 0; + foreach ($$player as $key => $value) { + if ($value['position'] != 'GK') { + $count_player++; + } + } // Aspettativa Team di Riferimento // (ATR) = Aspettativa Team * Numero di Giocatori di Team in Rosters (esclusi i portieri) / 10. // Ad esempio per Remo (supponiamo 24 giocatori nel Roster esclusi i portieri): ATR = 1.2 * 24 / 10 = 2.88 - - $asp_team_riferimento = (float) $asp_team * $player->count() / 10; + $asp_team_riferimento = (float) $asp_team * $count_player / 10; // dd($player->count(), $asp_team_riferimento); @@ -379,6 +397,7 @@ class PlayerPropsDrop extends Widget $tmp['asp_team'] = $asp_team; $tmp['asp_team_riferimento'] = $asp_team_riferimento; + $tmp['team_without_gk'] = $count_player; $position_field = $this->get_position($ss_player_id); if ($position_field) { @@ -410,68 +429,68 @@ class PlayerPropsDrop extends Widget $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; + $asp_statistica = (float) SofaScorePlayerPosition::where('ss_code', $position)->value('exp_'.$bettype); + $tmp['asp_statistica_'.$bettype] = $asp_statistica; 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; + $tmp['asp_gioco_'.$bettype] = $asp_statistica; + $tmp['asp_teorica_'.$bettype] = $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; + $tmp['asp_gioco_'.$bettype] = $asp_statistica; + $tmp['asp_teorica_'.$bettype] = $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; + $tmp['asp_gioco_'.$bettype] = $asp_statistica; + $tmp['asp_teorica_'.$bettype] = $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; + $tmp['asp_gioco_'.$bettype] = $asp_statistica; + $tmp['asp_teorica_'.$bettype] = $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; + $tmp['asp_gioco_'.$bettype] = $asp_statistica; + $tmp['asp_teorica_'.$bettype] = $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; + $tmp['asp_gioco_'.$bettype] = $asp_statistica; + $tmp['asp_teorica_'.$bettype] = $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; } @@ -482,7 +501,6 @@ class PlayerPropsDrop extends Widget // Aspettativa per Player: AP = AT * ATR / TOT AT $results[] = $tmp; - // for dev copy $this->calculationVariables[] = $tmp; } @@ -490,15 +508,14 @@ class PlayerPropsDrop extends Widget Log::debug('results', $results); - $bettypes = ['goals', 'cards', 'fouls', 'offsides', 'total_shots', 'shots_on_target']; foreach ($bettypes as $bettype) { - $total_bettype = array_sum(array_column($results, 'asp_teorica_' . $bettype)); + $total_bettype = array_sum(array_column($results, 'asp_teorica_'.$bettype)); foreach ($results as $key => $value) { // Aspettativa per Player: AP = AT * ATR / TOT AT - $results[$key]['asp_total_' . $bettype] = $total_bettype; + $results[$key]['asp_total_'.$bettype] = $total_bettype; // $results[$key]['asp_player_'.$bettype] = ((float) $value['asp_team'] * (float) $value['asp_teorica_'.$bettype]) / $total_bettype; - $results[$key]['asp_player_' . $bettype] = ($asp_team * $asp_team_riferimento) / $total_bettype; + $results[$key]['asp_player_'.$bettype] = ($asp_team * $asp_team_riferimento) / $total_bettype; } } diff --git a/composer.lock b/composer.lock index 6d951283..9508264c 100644 --- a/composer.lock +++ b/composer.lock @@ -5269,16 +5269,16 @@ }, { "name": "nikic/php-parser", - "version": "v5.8.0", + "version": "v5.9.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "044a6a392ff8ad0d61f14370a5fbbd0a0107152f" + "reference": "9e33da9553fe7786f0962b35f4e4ecf01be89def" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/044a6a392ff8ad0d61f14370a5fbbd0a0107152f", - "reference": "044a6a392ff8ad0d61f14370a5fbbd0a0107152f", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/9e33da9553fe7786f0962b35f4e4ecf01be89def", + "reference": "9e33da9553fe7786f0962b35f4e4ecf01be89def", "shasum": "" }, "require": { @@ -5320,9 +5320,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.8.0" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.9.0" }, - "time": "2026-07-04T14:30:18+00:00" + "time": "2026-09-13T18:51:52+00:00" }, { "name": "nunomaduro/termwind", @@ -12685,21 +12685,21 @@ }, { "name": "rector/rector", - "version": "2.6.6", + "version": "2.6.7", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "ca069d6c79feaa6651b423c15d101a27a436093e" + "reference": "f4aa224edb9b0630fb43826d4cb6a49b62e48d4c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/ca069d6c79feaa6651b423c15d101a27a436093e", - "reference": "ca069d6c79feaa6651b423c15d101a27a436093e", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/f4aa224edb9b0630fb43826d4cb6a49b62e48d4c", + "reference": "f4aa224edb9b0630fb43826d4cb6a49b62e48d4c", "shasum": "" }, "require": { "php": "^7.4|^8.0", - "phpstan/phpstan": "^2.2.10" + "phpstan/phpstan": "^2.2.14" }, "conflict": { "rector/rector-doctrine": "*", @@ -12730,7 +12730,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/2.6.6" + "source": "https://github.com/rectorphp/rector/tree/2.6.7" }, "funding": [ { @@ -12738,7 +12738,7 @@ "type": "github" } ], - "time": "2026-09-02T09:38:46+00:00" + "time": "2026-09-13T20:17:44+00:00" }, { "name": "sebastian/cli-parser",