diff --git a/app/Filament/Clusters/StaticData/Resources/StatistikoConfigs/Tables/StatistikoConfigsTable.php b/app/Filament/Clusters/StaticData/Resources/StatistikoConfigs/Tables/StatistikoConfigsTable.php index df71bdfc..84e9332d 100644 --- a/app/Filament/Clusters/StaticData/Resources/StatistikoConfigs/Tables/StatistikoConfigsTable.php +++ b/app/Filament/Clusters/StaticData/Resources/StatistikoConfigs/Tables/StatistikoConfigsTable.php @@ -22,6 +22,7 @@ class StatistikoConfigsTable 'crd' => 'Cards', 'snt' => 'Shots On Target', 'tsh' => 'Total Shots', + 'wfl' => 'Was Fouled', 'all' => 'Method B', }), TextColumn::make('team')->badge() @@ -54,6 +55,7 @@ class StatistikoConfigsTable 'crd' => 'Cards', 'snt' => 'Shots On Target', 'tsh' => 'Total Shots', + 'wfl' => 'Was Fouled', ]), SelectFilter::make('team') ->options([ diff --git a/app/Filament/Exports/EventsHistoryExporter.php b/app/Filament/Exports/EventsHistoryExporter.php index a37535f4..377dd8d4 100644 --- a/app/Filament/Exports/EventsHistoryExporter.php +++ b/app/Filament/Exports/EventsHistoryExporter.php @@ -36,6 +36,8 @@ class EventsHistoryExporter extends Exporter ExportColumn::make('tsh_a'), ExportColumn::make('crd_h'), ExportColumn::make('crd_a'), + ExportColumn::make('wfl_h'), + ExportColumn::make('wfl_a'), ExportColumn::make('exp_home'), ExportColumn::make('exp_away'), ExportColumn::make('exp_handicap'), diff --git a/app/Filament/Pages/Statistic.php b/app/Filament/Pages/Statistic.php index d7b646f7..b8599769 100644 --- a/app/Filament/Pages/Statistic.php +++ b/app/Filament/Pages/Statistic.php @@ -298,6 +298,18 @@ class Statistic extends BaseDashboard $row[] = $data['tsh_liga_season']['home']; $row[] = $data['tsh_liga_season']['away']; $copystring .= implode(';', $row)."\n"; + $row = []; + $row = array_fill(0, 5, ''); + $row[] = 'Was Fouled'; + $row[] = $data['wfl']['home']; + $row[] = $data['wfl']['away']; + $row[] = $data['wfl_team']['home']; + $row[] = $data['wfl_team']['away']; + $row[] = $data['wfl_team_season']['home']; + $row[] = $data['wfl_team_season']['away']; + $row[] = $data['wfl_liga_season']['home']; + $row[] = $data['wfl_liga_season']['away']; + $copystring .= implode(';', $row)."\n"; return $copystring; } @@ -479,6 +491,7 @@ class Statistic extends BaseDashboard 'crd' => 'phosphor-cards', 'snt' => 'phosphor-target', 'tsh' => 'phosphor-chart-polar', + 'wfl' => 'phosphor-first-aid-kit', default => 'phosphor-soccer-ball', }; }) @@ -492,6 +505,7 @@ class Statistic extends BaseDashboard 'crd' => 'Cards', 'snt' => 'Shots On Target', 'tsh' => 'Total Shots', + 'wfl' => 'Was Fouled', ]); } diff --git a/app/Filament/Widgets/Boxes/AverageLeagueSeason.php b/app/Filament/Widgets/Boxes/AverageLeagueSeason.php index b2d2a06e..9e604954 100644 --- a/app/Filament/Widgets/Boxes/AverageLeagueSeason.php +++ b/app/Filament/Widgets/Boxes/AverageLeagueSeason.php @@ -34,9 +34,10 @@ class AverageLeagueSeason ExpectationAverage::filter($result, 'liga', 'crd', $val->crd_h, $val->crd_a); ExpectationAverage::filter($result, 'liga', 'snt', $val->snt_h, $val->snt_a); ExpectationAverage::filter($result, 'liga', 'tsh', $val->tsh_h, $val->tsh_a); + ExpectationAverage::filter($result, 'liga', 'wfl', $val->wfl_h, $val->wfl_a); } - $bets = ['gls', 'crn', 'fls', 'ofs', 'crd', 'snt', 'tsh']; + $bets = ['gls', 'crn', 'fls', 'ofs', 'crd', 'snt', 'tsh', 'wfl']; if ($result) { foreach ($bets as $bet) { $expectations[$bet.'_liga_season']['home'] = round(array_sum($result['liga'][$bet]['home']) / \count($result['liga'][$bet]['home']), 1); @@ -55,6 +56,7 @@ class AverageLeagueSeason $expectations['crd_liga_season']['name'] = 'Cards'; $expectations['snt_liga_season']['name'] = 'Shots on Target'; $expectations['tsh_liga_season']['name'] = 'Total Shots'; + $expectations['wfl_liga_season']['name'] = 'Was Fouled'; $expectations['active_season'] = $active_season; } } diff --git a/app/Filament/Widgets/Boxes/AverageTeam.php b/app/Filament/Widgets/Boxes/AverageTeam.php index 9b7f8356..60c3b387 100644 --- a/app/Filament/Widgets/Boxes/AverageTeam.php +++ b/app/Filament/Widgets/Boxes/AverageTeam.php @@ -72,6 +72,7 @@ class AverageTeam ExpectationAverage::filter($result, 'team', 'crd', $val->crd_h, $val->crd_a); ExpectationAverage::filter($result, 'team', 'snt', $val->snt_h, $val->snt_a); ExpectationAverage::filter($result, 'team', 'tsh', $val->tsh_h, $val->tsh_a); + ExpectationAverage::filter($result, 'team', 'wfl', $val->wfl_h, $val->wfl_a); } elseif ($team_position == 'away' && $team_id == $val->away_id) { ExpectationAverage::filter($result, 'team', 'gls', $val->gls_a, $val->gls_h); ExpectationAverage::filter($result, 'team', 'crn', $val->crn_a, $val->crn_h); @@ -80,6 +81,7 @@ class AverageTeam ExpectationAverage::filter($result, 'team', 'crd', $val->crd_a, $val->crd_h); ExpectationAverage::filter($result, 'team', 'snt', $val->snt_a, $val->snt_h); ExpectationAverage::filter($result, 'team', 'tsh', $val->tsh_a, $val->tsh_h); + ExpectationAverage::filter($result, 'team', 'wfl', $val->wfl_a, $val->wfl_h); } else { if ($team_id == $val->home_id) { ExpectationAverage::filter($result, 'team', 'gls', $val->gls_h, $val->gls_a); @@ -89,6 +91,7 @@ class AverageTeam ExpectationAverage::filter($result, 'team', 'crd', $val->crd_h, $val->crd_a); ExpectationAverage::filter($result, 'team', 'snt', $val->snt_h, $val->snt_a); ExpectationAverage::filter($result, 'team', 'tsh', $val->tsh_h, $val->tsh_a); + ExpectationAverage::filter($result, 'team', 'wfl', $val->wfl_h, $val->wfl_a); } elseif ($team_id == $val->away_id) { ExpectationAverage::filter($result, 'team', 'gls', $val->gls_a, $val->gls_h); ExpectationAverage::filter($result, 'team', 'crn', $val->crn_a, $val->crn_h); @@ -97,6 +100,7 @@ class AverageTeam ExpectationAverage::filter($result, 'team', 'crd', $val->crd_a, $val->crd_h); ExpectationAverage::filter($result, 'team', 'snt', $val->snt_a, $val->snt_h); ExpectationAverage::filter($result, 'team', 'tsh', $val->tsh_a, $val->tsh_h); + ExpectationAverage::filter($result, 'team', 'wfl', $val->wfl_a, $val->wfl_h); } } } @@ -120,6 +124,7 @@ class AverageTeam $expectations['crd_team']['name'] = 'Cards'; $expectations['snt_team']['name'] = 'Shots on Target'; $expectations['tsh_team']['name'] = 'Total Shots'; + $expectations['wfl_team']['name'] = 'Was Fouled'; } } } diff --git a/app/Filament/Widgets/Boxes/AverageTeamSeason.php b/app/Filament/Widgets/Boxes/AverageTeamSeason.php index 5d38e49b..bd8e4a18 100644 --- a/app/Filament/Widgets/Boxes/AverageTeamSeason.php +++ b/app/Filament/Widgets/Boxes/AverageTeamSeason.php @@ -47,6 +47,7 @@ class AverageTeamSeason ExpectationAverage::filter($result, 'team', 'crd', $val->crd_h, $val->crd_a); ExpectationAverage::filter($result, 'team', 'snt', $val->snt_h, $val->snt_a); ExpectationAverage::filter($result, 'team', 'tsh', $val->tsh_h, $val->tsh_a); + ExpectationAverage::filter($result, 'team', 'wfl', $val->wfl_h, $val->wfl_a); } elseif ($team_position == 'away' && $team_id == $val->away_id) { ExpectationAverage::filter($result, 'team', 'gls', $val->gls_a, $val->gls_h); ExpectationAverage::filter($result, 'team', 'crn', $val->crn_a, $val->crn_h); @@ -55,6 +56,7 @@ class AverageTeamSeason ExpectationAverage::filter($result, 'team', 'crd', $val->crd_a, $val->crd_h); ExpectationAverage::filter($result, 'team', 'snt', $val->snt_a, $val->snt_h); ExpectationAverage::filter($result, 'team', 'tsh', $val->tsh_a, $val->tsh_h); + ExpectationAverage::filter($result, 'team', 'wfl', $val->wfl_a, $val->wfl_h); } else { if ($team_id == $val->home_id) { ExpectationAverage::filter($result, 'team', 'gls', $val->gls_h, $val->gls_a); @@ -64,6 +66,7 @@ class AverageTeamSeason ExpectationAverage::filter($result, 'team', 'crd', $val->crd_h, $val->crd_a); ExpectationAverage::filter($result, 'team', 'snt', $val->snt_h, $val->snt_a); ExpectationAverage::filter($result, 'team', 'tsh', $val->tsh_h, $val->tsh_a); + ExpectationAverage::filter($result, 'team', 'wfl', $val->wfl_h, $val->wfl_a); } elseif ($team_id == $val->away_id) { ExpectationAverage::filter($result, 'team', 'gls', $val->gls_a, $val->gls_h); ExpectationAverage::filter($result, 'team', 'crn', $val->crn_a, $val->crn_h); @@ -72,11 +75,12 @@ class AverageTeamSeason ExpectationAverage::filter($result, 'team', 'crd', $val->crd_a, $val->crd_h); ExpectationAverage::filter($result, 'team', 'snt', $val->snt_a, $val->snt_h); ExpectationAverage::filter($result, 'team', 'tsh', $val->tsh_a, $val->tsh_h); + ExpectationAverage::filter($result, 'team', 'wfl', $val->wfl_a, $val->wfl_h); } } } - $bets = ['gls', 'crn', 'fls', 'ofs', 'crd', 'snt', 'tsh']; + $bets = ['gls', 'crn', 'fls', 'ofs', 'crd', 'snt', 'tsh', 'wfl']; if ($result) { foreach ($bets as $bet) { $expectations[$bet.'_team_season']['home'] = round(array_sum($result['team'][$bet]['home']) / \count($result['team'][$bet]['home']), 1); @@ -95,6 +99,7 @@ class AverageTeamSeason $expectations['crd_team_season']['name'] = 'Cards'; $expectations['snt_team_season']['name'] = 'Shots on Target'; $expectations['tsh_team_season']['name'] = 'Total Shots'; + $expectations['wfl_team_season']['name'] = 'Was Fouled'; $expectations['active_season'] = $season; } } diff --git a/app/Filament/Widgets/Boxes/ExpectationsBox3.php b/app/Filament/Widgets/Boxes/ExpectationsBox3.php index 96507fe2..7abb9d3d 100644 --- a/app/Filament/Widgets/Boxes/ExpectationsBox3.php +++ b/app/Filament/Widgets/Boxes/ExpectationsBox3.php @@ -50,6 +50,9 @@ class ExpectationsBox3 // TSH $tmp['tsh']['home'] += $val->tsh_h; $tmp['tsh']['away'] += $val->tsh_a; + // WFL + $tmp['wfl']['home'] += $val->wfl_h; + $tmp['wfl']['away'] += $val->wfl_a; } foreach ($bets as $bet) { $expectations[$bet]['home'] = round($tmp[$bet]['home'] / $events, 1); @@ -89,6 +92,10 @@ class ExpectationsBox3 $tmp['tsh']['home']['events']['home']++; $tmp['tsh']['home']['scored']['home'] += $val->tsh_h; $tmp['tsh']['home']['conceded']['home'] += $val->tsh_a; + // TSH + $tmp['wfl']['home']['events']['home']++; + $tmp['wfl']['home']['scored']['home'] += $val->wfl_h; + $tmp['wfl']['home']['conceded']['home'] += $val->wfl_a; } // away home @@ -121,6 +128,10 @@ class ExpectationsBox3 $tmp['tsh']['away']['events']['home']++; $tmp['tsh']['away']['scored']['home'] += $val->tsh_h; $tmp['tsh']['away']['conceded']['home'] += $val->tsh_a; + // WFL + $tmp['wfl']['away']['events']['home']++; + $tmp['wfl']['away']['scored']['home'] += $val->wfl_h; + $tmp['wfl']['away']['conceded']['home'] += $val->wfl_a; } // home away if ($match->home_id == $val->away_id) { @@ -152,6 +163,10 @@ class ExpectationsBox3 $tmp['tsh']['home']['events']['away']++; $tmp['tsh']['home']['scored']['away'] += $val->tsh_a; $tmp['tsh']['home']['conceded']['away'] += $val->tsh_h; + // WFL + $tmp['wfl']['home']['events']['away']++; + $tmp['wfl']['home']['scored']['away'] += $val->wfl_a; + $tmp['wfl']['home']['conceded']['away'] += $val->wfl_h; } // away away @@ -184,6 +199,10 @@ class ExpectationsBox3 $tmp['tsh']['away']['events']['away']++; $tmp['tsh']['away']['scored']['away'] += $val->tsh_a; $tmp['tsh']['away']['conceded']['away'] += $val->tsh_h; + // WFL + $tmp['wfl']['away']['events']['away']++; + $tmp['wfl']['away']['scored']['away'] += $val->wfl_a; + $tmp['wfl']['away']['conceded']['away'] += $val->wfl_h; } } @@ -221,7 +240,7 @@ class ExpectationsBox3 public static function sceleton() { $tmp = []; - $bets = ['gls', 'crn', 'fls', 'ofs', 'crd', 'snt', 'tsh']; + $bets = ['gls', 'crn', 'fls', 'ofs', 'crd', 'snt', 'tsh', 'wfl']; foreach ($bets as $bet) { $tmp[$bet]['home']['events']['home'] = 0; $tmp[$bet]['home']['scored']['home'] = 0; diff --git a/app/Filament/Widgets/Boxes/Helper/ExpectationsMinMax.php b/app/Filament/Widgets/Boxes/Helper/ExpectationsMinMax.php index 6e0736be..9b2f6d3a 100644 --- a/app/Filament/Widgets/Boxes/Helper/ExpectationsMinMax.php +++ b/app/Filament/Widgets/Boxes/Helper/ExpectationsMinMax.php @@ -12,7 +12,7 @@ class ExpectationsMinMax * get min and max for each bettype from all DB for liga * make average */ - $bets = ['crn', 'fls', 'ofs', 'crd', 'snt', 'tsh']; + $bets = ['crn', 'fls', 'ofs', 'crd', 'snt', 'tsh', 'wfl']; $Y = 0.25; $res = StatistikoEvent::where('league_id', $match->league_id)->get(); @@ -43,6 +43,9 @@ class ExpectationsMinMax $data['crd']['home'] += $val->crd_h; $data['crd']['away'] += $val->crd_a; + + $data['wfl']['home'] += $val->wfl_h; + $data['wfl']['away'] += $val->wfl_a; } foreach ($data as $key => $value) { diff --git a/app/Filament/Widgets/Boxes/LoadEventsBoxes.php b/app/Filament/Widgets/Boxes/LoadEventsBoxes.php index 22ff86a4..260b8e54 100644 --- a/app/Filament/Widgets/Boxes/LoadEventsBoxes.php +++ b/app/Filament/Widgets/Boxes/LoadEventsBoxes.php @@ -41,6 +41,7 @@ class LoadEventsBoxes $expectations['crd']['name'] = 'Cards'; $expectations['snt']['name'] = 'Shots on Target'; $expectations['tsh']['name'] = 'Total Shots'; + $expectations['wfl']['name'] = 'Was Fouled'; $expectations['home'] = $home_team; $expectations['away'] = $away_team; @@ -69,7 +70,7 @@ class LoadEventsBoxes public static function template() { $arr = []; - $bets = ['gls', 'crn', 'fls', 'ofs', 'crd', 'snt', 'tsh']; + $bets = ['gls', 'crn', 'fls', 'ofs', 'crd', 'snt', 'tsh', 'wfl']; foreach ($bets as $bet) { foreach (['team_home', 'team_away'] as $team) { foreach (['scored', 'conceded'] as $sc) { diff --git a/app/Filament/Widgets/BoxesBettypeAll.php b/app/Filament/Widgets/BoxesBettypeAll.php index 15db2ddd..130e5159 100644 --- a/app/Filament/Widgets/BoxesBettypeAll.php +++ b/app/Filament/Widgets/BoxesBettypeAll.php @@ -139,7 +139,7 @@ class BoxesBettypeAll extends StatsOverviewWidget // TEAMPLATE BOX 1 protected function template_tabelle_1(array $data): HtmlString { - $bets = ['gls', 'crn', 'fls', 'ofs', 'crd', 'snt', 'tsh']; + $bets = ['gls', 'crn', 'fls', 'ofs', 'crd', 'snt', 'tsh', 'wfl']; $str = '
'; // $str .= '
Home
Away
'; foreach ($bets as $name) { diff --git a/app/Filament/Widgets/Charts/LoadEvents/LoadEventsAverages.php b/app/Filament/Widgets/Charts/LoadEvents/LoadEventsAverages.php index 7a80f2fb..63caa68b 100644 --- a/app/Filament/Widgets/Charts/LoadEvents/LoadEventsAverages.php +++ b/app/Filament/Widgets/Charts/LoadEvents/LoadEventsAverages.php @@ -81,6 +81,10 @@ class LoadEventsAverages $league_home[] = (int) $value['tsh_h']; $league_away[] = (int) $value['tsh_a']; break; + case 'wfl': + $league_home[] = (int) $value['wfl_h']; + $league_away[] = (int) $value['wfl_a']; + break; } if ((! $team_position || $team_position == 'all') && ($team_id == $value['home_id'] or $team_id == $value['away_id'])) { @@ -148,6 +152,15 @@ class LoadEventsAverages $team_away[] = (int) $value['tsh_h']; } break; + case 'wfl': + if ($team_id == $value['home_id']) { + $team_home[] = (int) $value['wfl_h']; + $team_away[] = (int) $value['wfl_a']; + } else { + $team_home[] = (int) $value['wfl_a']; + $team_away[] = (int) $value['wfl_h']; + } + break; } } elseif ($team_position == 'home' && $team_id == $value['home_id']) { switch ($statistic_type) { @@ -179,6 +192,10 @@ class LoadEventsAverages $team_home[] = (int) $value['tsh_h']; $team_away[] = (int) $value['tsh_a']; break; + case 'wfl': + $team_home[] = (int) $value['wfl_h']; + $team_away[] = (int) $value['wfl_a']; + break; } } elseif ($team_position == 'away' && $team_id == $value['away_id']) { switch ($statistic_type) { @@ -210,6 +227,10 @@ class LoadEventsAverages $team_home[] = (int) $value['tsh_a']; $team_away[] = (int) $value['tsh_h']; break; + case 'wfl': + $team_home[] = (int) $value['wfl_a']; + $team_away[] = (int) $value['wfl_h']; + break; } } } diff --git a/app/Filament/Widgets/Charts/LoadEvents/LoadEventsQuery.php b/app/Filament/Widgets/Charts/LoadEvents/LoadEventsQuery.php index 6f01e692..b986d304 100644 --- a/app/Filament/Widgets/Charts/LoadEvents/LoadEventsQuery.php +++ b/app/Filament/Widgets/Charts/LoadEvents/LoadEventsQuery.php @@ -187,6 +187,10 @@ class LoadEventsQuery $tmp['val_home'] = $value->tsh_h; $tmp['val_away'] = $value->tsh_a; break; + case 'wfl': + $tmp['val_home'] = $value->wfl_h; + $tmp['val_away'] = $value->wfl_a; + break; } $arr['all'][] = $tmp; diff --git a/app/Filament/Widgets/PlayerProps/Expectations.php b/app/Filament/Widgets/PlayerProps/Expectations.php index b4e43788..9a1865b0 100644 --- a/app/Filament/Widgets/PlayerProps/Expectations.php +++ b/app/Filament/Widgets/PlayerProps/Expectations.php @@ -16,7 +16,7 @@ class Expectations })->get(); $work = []; - $bettypes = ['gls', 'fls', 'crn', 'ofs', 'crd', 'snt', 'tsh']; + $bettypes = ['gls', 'fls', 'crn', 'ofs', 'crd', 'snt', 'tsh', 'wfl']; foreach ($data as $value) { foreach ($bettypes as $type) { if ($value['home_id'] == $home_id) { @@ -69,8 +69,10 @@ class Expectations $num_away_snt = 0; $num_home_tsh = 0; $num_away_tsh = 0; + $num_home_wfl = 0; + $num_away_wfl = 0; - $bettypes = ['gls', 'crd', 'fls', 'ofs', 'snt', 'tsh']; + $bettypes = ['gls', 'crd', 'fls', 'ofs', 'snt', 'tsh', 'wfl']; foreach ($work as $type => $value) { switch ($type) { @@ -224,6 +226,31 @@ class Expectations $sum_away_tsh += array_sum($value['away_got_away']); $num_away_tsh += \count($value['away_got_away']); break; + case 'wfl': + $sum_home_wfl = array_sum($value['home_made_total']); + $num_home_wfl = \count($value['home_made_total']); + + $sum_home_wfl += array_sum($value['home_made_home']); + $num_home_wfl += \count($value['home_made_home']); + + $sum_home_wfl += array_sum($value['home_got_total']); + $num_home_wfl += \count($value['home_got_total']); + + $sum_home_wfl += array_sum($value['home_got_home']); + $num_home_wfl += \count($value['home_got_home']); + + $sum_away_wfl = array_sum($value['away_made_total']); + $num_away_wfl = \count($value['away_made_total']); + + $sum_away_wfl += array_sum($value['away_made_away']); + $num_away_wfl += \count($value['away_made_away']); + + $sum_away_wfl += array_sum($value['away_got_total']); + $num_away_wfl += \count($value['away_got_total']); + + $sum_away_wfl += array_sum($value['away_got_away']); + $num_away_wfl += \count($value['away_got_away']); + break; } } @@ -234,6 +261,7 @@ class Expectations $aspettativa['home']['ofs'] = round($sum_home_ofs / $num_home_ofs, 1); $aspettativa['home']['snt'] = round($sum_home_snt / $num_home_snt, 1); $aspettativa['home']['tsh'] = round($sum_home_tsh / $num_home_tsh, 1); + $aspettativa['home']['wfl'] = round($sum_home_wfl / $num_home_wfl, 1); $aspettativa['away']['gls'] = round($sum_away_gls / $sum_away_gls, 1); $aspettativa['away']['crd'] = round($sum_away_crd / $num_away_crd, 1); @@ -241,6 +269,7 @@ class Expectations $aspettativa['away']['ofs'] = round($sum_away_ofs / $num_away_ofs, 1); $aspettativa['away']['snt'] = round($sum_away_snt / $num_away_snt, 1); $aspettativa['away']['tsh'] = round($sum_away_tsh / $num_away_tsh, 1); + $aspettativa['away']['wfl'] = round($sum_away_wfl / $num_away_wfl, 1); return $aspettativa; } diff --git a/app/Filament/Widgets/PlayerPropsDrop.php b/app/Filament/Widgets/PlayerPropsDrop.php index fbf46e93..4e359edb 100644 --- a/app/Filament/Widgets/PlayerPropsDrop.php +++ b/app/Filament/Widgets/PlayerPropsDrop.php @@ -155,6 +155,7 @@ class PlayerPropsDrop extends Widget $tmp['crd'] = $val['cards']; $tmp['snt'] = $val['shots_on_target']; $tmp['tsh'] = $val['shots_off_target']; + $tmp['wfl'] = $val['was_fouled']; $level = round($val['total_events'] / 3); if ($val['total_events']) { @@ -383,6 +384,7 @@ class PlayerPropsDrop extends Widget $this->players[$k]['crd'] = ''; $this->players[$k]['snt'] = ''; $this->players[$k]['tsh'] = ''; + $this->players[$k]['wfl'] = ''; } $this->storePlacement(); @@ -407,6 +409,7 @@ class PlayerPropsDrop extends Widget $this->players[$k]['crd'] = ''; $this->players[$k]['snt'] = ''; $this->players[$k]['tsh'] = ''; + $this->players[$k]['wfl'] = ''; } $this->player_on_field_counter = 0; @@ -450,7 +453,7 @@ class PlayerPropsDrop extends Widget return; } - $header = ['name', 'foot', 'events', 'average min', 'position', 'on field', 'gls', 'fls', 'ofs', 'crd', 'snt', 'tsh']; + $header = ['name', 'foot', 'events', 'average min', 'position', 'on field', 'gls', 'fls', 'ofs', 'crd', 'snt', 'tsh', 'wfl']; $copystring = implode(';', $header)."\n"; foreach ($this->players as $row) { $tmp = []; @@ -470,6 +473,7 @@ class PlayerPropsDrop extends Widget $tmp[] = $row['crd']; $tmp[] = $row['snt']; $tmp[] = $row['tsh']; + $tmp[] = $row['wfl']; $copystring .= implode(';', $tmp)."\n"; } @@ -491,6 +495,7 @@ class PlayerPropsDrop extends Widget $this->players[$k]['crd'] = ''; $this->players[$k]['snt'] = ''; $this->players[$k]['tsh'] = ''; + $this->players[$k]['wfl'] = ''; } $this->dispatch('update-players', players: $this->players); @@ -597,7 +602,7 @@ class PlayerPropsDrop extends Widget // exp_total_shots // exp_shots_on_target - $bettypes = ['goals', 'cards', 'fouls', 'offsides', 'total_shots', 'shots_on_target']; + $bettypes = ['goals', 'cards', 'fouls', 'offsides', 'total_shots', 'shots_on_target', 'was_fouled']; foreach ($bettypes as $bettype) { $asp_statistica = (float) SofaScorePlayerPosition::where('ss_code', $position)->value('exp_'.$bettype); @@ -673,6 +678,16 @@ class PlayerPropsDrop extends Widget $tmp['asp_teorica_'.$bettype] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value); } break; + case 'was_fouled': + $asp_gioco = $val['was_fouled'] / $val['total_min'] * 90; + if ($asp_gioco == 0 || $val['total_min'] < $this->y_value) { + $tmp['asp_gioco_'.$bettype] = 0; + $tmp['asp_teorica_'.$bettype] = $asp_statistica; + } else { + $tmp['asp_gioco_'.$bettype] = $asp_gioco; + $tmp['asp_teorica_'.$bettype] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value); + } + break; } } @@ -689,7 +704,7 @@ class PlayerPropsDrop extends Widget // (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 - $bettypes = ['goals', 'cards', 'fouls', 'offsides', 'total_shots', 'shots_on_target']; + $bettypes = ['goals', 'cards', 'fouls', 'offsides', 'total_shots', 'shots_on_target', 'was_fouled']; foreach ($bettypes as $bettype) { $total_bettype = array_sum(array_column($results, 'asp_teorica_'.$bettype)); @@ -736,6 +751,12 @@ class PlayerPropsDrop extends Widget $results[$key]['asp_total_'.$bettype] = $total_bettype; $results[$key]['asp_player_'.$bettype] = $value['asp_teorica_'.$bettype] * $asp_team_riferimento / $total_bettype; break; + case 'was_fouled': + $asp_team_riferimento = (float) $asp_team_all[$team_home_away]['wfl'] * $count_player / 10; + $results[$key]['asp_team_riferimento_wfl'] = $asp_team_riferimento; + $results[$key]['asp_total_'.$bettype] = $total_bettype; + $results[$key]['asp_player_'.$bettype] = $value['asp_teorica_'.$bettype] * $asp_team_riferimento / $total_bettype; + break; } } } @@ -749,9 +770,10 @@ class PlayerPropsDrop extends Widget $map[$val->position]['ofs'] = $val->ofs; $map[$val->position]['tsh'] = $val->tsh; $map[$val->position]['snt'] = $val->snt; + $map[$val->position]['wfl'] = $val->wfl; } - // stesso ordine di prima: GLS, CRD, FLS, OFS, TSH, SNT + // stesso ordine di prima: GLS, CRD, FLS, OFS, TSH, SNT, WFL foreach ($this->players as $k => $player) { foreach ($results as $key => $result) { @@ -800,6 +822,12 @@ class PlayerPropsDrop extends Widget $results[$key]['finale_tamx_snt'] = $tamx; $results[$key]['finale_calc_snt'] = $final; $this->players[$k]['snt'] = (float) $final > (float) $tamx ? $final : $tamx; + + $tamx = number_format($map[$pos]['wfl'], 3); + $final = number_format($result['asp_player_was_fouled'], 3); + $results[$key]['finale_tamx_wfl'] = $tamx; + $results[$key]['finale_calc_wfl'] = $final; + $this->players[$k]['wfl'] = (float) $final > (float) $tamx ? $final : $tamx; } } } @@ -1106,6 +1134,7 @@ class PlayerPropsDrop extends Widget $arr[$ss_player_id]['shots_off_target'] += $val->shots_off_target; $arr[$ss_player_id]['shots_blocked'] += $val->shots_blocked; $arr[$ss_player_id]['total_shots'] += $val->shots_on_target + $val->shots_off_target + $val->shots_blocked; + $arr[$ss_player_id]['was_fouled'] += $val->was_fouled; } foreach ($players as $value) { @@ -1138,6 +1167,7 @@ class PlayerPropsDrop extends Widget $arr[$ss_player_id]['shots_off_target'] = 0; $arr[$ss_player_id]['shots_blocked'] = 0; $arr[$ss_player_id]['total_shots'] = 0; + $arr[$ss_player_id]['was_fouled'] = 0; $arr[$ss_player_id]['cards'] = 0; } } diff --git a/app/Filament/Widgets/PlayerPropsTable.php b/app/Filament/Widgets/PlayerPropsTable.php index 14f1b049..0a30a675 100644 --- a/app/Filament/Widgets/PlayerPropsTable.php +++ b/app/Filament/Widgets/PlayerPropsTable.php @@ -33,16 +33,20 @@ class PlayerPropsTable extends TableWidget { return new HtmlString(' -
-
Gls
+
+
Gls
Fls
-
Ofs
+
Ofs
Crd
-
Snt
+
Snt
Tsh
-
Foot
+
Wfl
+
Foot
Evt
Min
+
+
+
'); } diff --git a/resources/css/filament/admin/theme.css b/resources/css/filament/admin/theme.css index 32c87808..cc81f85b 100644 --- a/resources/css/filament/admin/theme.css +++ b/resources/css/filament/admin/theme.css @@ -27,6 +27,10 @@ } } +.text-xxs { + font-size: 9.5px; +} + /* Reduce gap between widgets and content */ .fi-page-content { @apply gap-y-5; diff --git a/resources/views/filament/tables/columns/drag-card.blade.php b/resources/views/filament/tables/columns/drag-card.blade.php index 2de64779..5305b59e 100644 --- a/resources/views/filament/tables/columns/drag-card.blade.php +++ b/resources/views/filament/tables/columns/drag-card.blade.php @@ -3,19 +3,19 @@ @endphp @if ($record['active'])
-
-
{{ $record['gls'] }}
-
{{ $record['fls'] }}
-
{{ $record['ofs'] }}
-
{{ $record['crd'] }}
-
{{ $record['snt'] }}
-
{{ $record['tsh'] }}
-
{{ $record['foot'] }}
-
{{ $record['tot_evt'] }}
-
{{ $record['ave_min'] }}
-
{{ $record['pos'] }}
-
+ class="w-full mt-1 p-1 border dark:border-gray-600 border-gray-200 text-xxs select-none rounded transition-colors grid grid-cols-18 gap-1 items-center"> +
{{ $record['gls'] }}
+
{{ $record['fls'] }}
+
{{ $record['ofs'] }}
+
{{ $record['crd'] }}
+
{{ $record['snt'] }}
+
{{ $record['tsh'] }}
+
{{ $record['snt'] }}
+
{{ $record['wfl'] }}
+
{{ $record['foot'] }}
+
{{ $record['tot_evt'] }}
+
{{ $record['ave_min'] }}
+
{{ $record['pos'] }}
{{ ucfirst($record['pos_ori']) }} @@ -33,19 +33,19 @@ e.dataTransfer.effectAllowed = 'copy'; e.dataTransfer.setData('text/plain', JSON.stringify({ id: {{ $record['id'] }} })); }" - class="w-full mt-1 border dark:border-gray-600 border-gray-200 hover:border-blue-500 text-xs select-none cursor-grab active:cursor-grabbing rounded transition-colors grid grid-cols-16 gap-1 items-center"> -
-
{{ $record['gls'] }}
-
{{ $record['fls'] }}
-
{{ $record['ofs'] }}
-
{{ $record['crd'] }}
-
{{ $record['snt'] }}
-
{{ $record['tsh'] }}
-
{{ $record['foot'] }}
-
{{ $record['tot_evt'] }}
-
{{ $record['ave_min'] }}
-
-
+ class="w-full mt-1 p-1 border dark:border-gray-600 border-gray-200 hover:border-blue-500 text-xxs select-none cursor-grab active:cursor-grabbing rounded transition-colors grid grid-cols-18 gap-1 items-center"> +
{{ $record['gls'] }}
+
{{ $record['fls'] }}
+
{{ $record['ofs'] }}
+
{{ $record['crd'] }}
+
{{ $record['snt'] }}
+
{{ $record['tsh'] }}
+
{{ $record['snt'] }}
+
{{ $record['wfl'] }}
+
{{ $record['foot'] }}
+
{{ $record['tot_evt'] }}
+
{{ $record['ave_min'] }}
+
{{ ucfirst($record['pos_ori']) }}