diff --git a/app/Filament/Imports/Helper/ImportDetails.php b/app/Filament/Imports/Helper/ImportDetails.php index e6657341..a2f36b59 100644 --- a/app/Filament/Imports/Helper/ImportDetails.php +++ b/app/Filament/Imports/Helper/ImportDetails.php @@ -61,7 +61,7 @@ class ImportDetails } }); - StatistikoDetail::where('updated_at', '!=', $now)->update(['is_active' => 0]); + StatistikoDetail::where('updated_at', '!=', $now)->update(['is_active' => 0, 'ss_team_id' => 0]); /**update statistic player tabel */ UpdateHelper::updatePlayers(1000000); diff --git a/app/Filament/Widgets/PlayerPropsDrop.php b/app/Filament/Widgets/PlayerPropsDrop.php index fa6370c9..e3c68772 100644 --- a/app/Filament/Widgets/PlayerPropsDrop.php +++ b/app/Filament/Widgets/PlayerPropsDrop.php @@ -349,11 +349,13 @@ class PlayerPropsDrop extends Widget $count_player = 0; foreach ($player as $key => $value) { - if ($value['position'] != 'GK') { + if ($value['position'] != 'GK' and $value['is_active'] == 1) { $count_player++; } } + dd($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 @@ -395,6 +397,7 @@ class PlayerPropsDrop extends Widget $tmp['id'] = $ss_player_id; $tmp['name'] = $val->details->player_name; + $tmp['id_team'] = $team_id; $tmp['asp_team'] = $asp_team; $tmp['asp_team_riferimento'] = $asp_team_riferimento; $tmp['player_count_without_gk'] = $count_player; diff --git a/app/Traits/UpdateHelper.php b/app/Traits/UpdateHelper.php index a1c05773..e4e025ff 100644 --- a/app/Traits/UpdateHelper.php +++ b/app/Traits/UpdateHelper.php @@ -46,9 +46,9 @@ trait UpdateHelper } try { - $this->updatePlayers($playerCount); + self::updatePlayers($playerCount); } catch (\Exception $e) { - $this->error(get_class($e) . ' ' . Str::of($e->getMessage())->limit(100)->value()); + $this->error(get_class($e).' '.Str::of($e->getMessage())->limit(100)->value()); } if ($this->debug) { @@ -97,8 +97,8 @@ trait UpdateHelper $formattedTime = match (true) { $executionTime >= 60 => sprintf('%dm %ds', floor($executionTime / 60), $executionTime % 60), - $executionTime >= 1 => round($executionTime, 2) . 's', - default => round($executionTime * 1000) . 'ms', + $executionTime >= 1 => round($executionTime, 2).'s', + default => round($executionTime * 1000).'ms', }; $this->newLine(); @@ -112,7 +112,7 @@ trait UpdateHelper $this->newLine(); } - protected function updatePlayers(int $playerCount) + public static function updatePlayers(int $playerCount) { $res_player = StatistikoDetail::query()->where('is_active', 1)->limit($playerCount)->pluck('ss_player_id')->toArray();