From f3f0a5d8159365b2504bac0a8aa967d64cf283b3 Mon Sep 17 00:00:00 2001 From: salam Date: Sun, 1 Nov 2026 16:45:17 +0100 Subject: [PATCH] wip --- app/Filament/Widgets/PlayerPropsDrop.php | 4 +++- app/Traits/PlayerProps/PlayerAspg.php | 3 ++- app/Traits/PlayerProps/PlayerQuery.php | 22 +++++++++------------- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/app/Filament/Widgets/PlayerPropsDrop.php b/app/Filament/Widgets/PlayerPropsDrop.php index 0e913d76..8a125df9 100644 --- a/app/Filament/Widgets/PlayerPropsDrop.php +++ b/app/Filament/Widgets/PlayerPropsDrop.php @@ -174,7 +174,9 @@ class PlayerPropsDrop extends Widget $this->generateLineUp(); - $this->calculateAspg(); + // if ($this->player_on_field_counter >= 10) { + // $this->calculateAspg(); + // } } diff --git a/app/Traits/PlayerProps/PlayerAspg.php b/app/Traits/PlayerProps/PlayerAspg.php index f816b56e..61d4f514 100644 --- a/app/Traits/PlayerProps/PlayerAspg.php +++ b/app/Traits/PlayerProps/PlayerAspg.php @@ -4,6 +4,7 @@ namespace App\Traits\PlayerProps; use App\Models\StatisticFixtures; use App\Models\StatistikoDetail; +use Illuminate\Support\Facades\Log; trait PlayerAspg { @@ -29,7 +30,7 @@ trait PlayerAspg return; } - // Log::debug('calculateAspg', $this->players); + Log::debug('calculateAspg', $this->players); // Calcolare Aspettativa Team per GOALS // (il valore che appare quando viene selezionato un Evento): nell' esempio, diff --git a/app/Traits/PlayerProps/PlayerQuery.php b/app/Traits/PlayerProps/PlayerQuery.php index 31c04c6f..3194f6ec 100644 --- a/app/Traits/PlayerProps/PlayerQuery.php +++ b/app/Traits/PlayerProps/PlayerQuery.php @@ -88,7 +88,7 @@ trait PlayerQuery } $arr = []; - $res = $this->getPlayers(1, $player_ids); + $res = StatistikoPlayer::with('details')->whereIn('ss_player_id', $player_ids)->get(); foreach ($res as $val) { $ss_player_id = (int) $val->ss_player_id; $activeteam_id = (int) $val->activeteam_id; @@ -182,26 +182,22 @@ trait PlayerQuery $this->season_selected = $this->getCurrentSeason(); } - $sesson_int_string = []; - foreach ($this->season_selected as $value) { - if (strpos($value, '/') !== false) { - $sesson_int_string[] = (string) $value; - } else { - $sesson_int_string[] = (string) $value; - $sesson_int_string[] = (int) $value; - } + if ($this->season_mode == 'halftime') { + $this->season_selected = array_map('strval', $this->season_selected); + } else { + $this->season_selected = array_map('intval', $this->season_selected); } return match ($part) { 1 => StatistikoPlayer::with('details') ->whereIn('ss_player_id', $player_ids) - ->when($this->season_selected, function ($query) use ($sesson_int_string) { - return $query->whereIn('season', $sesson_int_string); + ->when($this->season_selected, function ($query) { + return $query->whereIn('season', $this->season_selected); })->get(), 2 => StatistikoPlayer::with('details') ->whereIn('ss_player_id', $player_ids) - ->when($this->season_selected, function ($query) use ($sesson_int_string) { - return $query->whereNotIn('season', $sesson_int_string); + ->when($this->season_selected, function ($query) { + return $query->whereNotIn('season', $this->season_selected); })->get(), };