This commit is contained in:
salam committed 2026-10-11 08:53:37 +02:00
1 parent e3e74f7d91
commit 34701ecbff
2 files changed
+13 -30

No files matched your search

@@ -25,7 +25,7 @@ class ListStatistikoPlayers extends ListRecords
->chunkSize(1000) ->chunkSize(1000)
->exporter(PlayerHistoryExporter::class) ->exporter(PlayerHistoryExporter::class)
->label('Download') ->label('Download')
->fileName(fn(Export $export): string => 'player-history-' . date('d.m.Y-H.i') . "-{$export->getKey()}") ->fileName(fn (Export $export): string => 'player-history-'.date('d.m.Y-H.i')."-{$export->getKey()}")
->icon('phosphor-download'), ->icon('phosphor-download'),
Action::make('count') Action::make('count')
->color('gray') ->color('gray')
@@ -34,11 +34,11 @@ class ListStatistikoPlayers extends ListRecords
->schema([ ->schema([
Select::make('field') Select::make('field')
->options([ ->options([
'minutes_played' => 'minutes_played', 'minutes_played' => 'minutes_played',
'card_yellow' => 'card_yellow', 'card_yellow' => 'card_yellow',
'card_yellowred' => 'card_yellowred', 'card_yellowred' => 'card_yellowred',
'card_red' => 'card_red', 'card_red' => 'card_red',
]) ]),
]) ])
->action(function (array $data): void { ->action(function (array $data): void {
$players = StatistikoPlayer::where('ss_player_id', 1087079)->get(); $players = StatistikoPlayer::where('ss_player_id', 1087079)->get();
@@ -55,6 +55,7 @@ class ListStatistikoPlayers extends ListRecords
->modalSubmitAction(false) ->modalSubmitAction(false)
->modalContent(function () { ->modalContent(function () {
$players = StatistikoPlayer::where('starttime', '<', new DateTime('-10 years'))->get(); $players = StatistikoPlayer::where('starttime', '<', new DateTime('-10 years'))->get();
return view('filament.pages.list-player-starttime', ['players' => $players]); return view('filament.pages.list-player-starttime', ['players' => $players]);
}), }),
Action::make('missing') Action::make('missing')
@@ -65,26 +66,8 @@ class ListStatistikoPlayers extends ListRecords
->icon('phosphor-magnifying-glass') ->icon('phosphor-magnifying-glass')
->modalContent(function () { ->modalContent(function () {
$players = StatistikoPlayer::doesntHave('details')->groupBy('ss_player_id')->get(); $players = StatistikoPlayer::doesntHave('details')->groupBy('ss_player_id')->get();
return view('filament.pages.list-missing-player', ['players' => $players]);
}),
Action::make('double')
->modalSubmitAction(false)
->icon('phosphor-magnifying-glass')
->color('gray')
->modalContent(function () {
$arr = [];
$doubles = [];
$events = StatistikoPlayer::query()->select('match_id', 'ss_player_id')->get()->toArray();
foreach ($events as $value) {
$match_id = $value['match_id'];
$player_id = $value['ss_player_id'];
if (isset($arr[$match_id]) && in_array($player_id, $arr[$match_id])) { return view('filament.pages.list-missing-player', ['players' => $players]);
$doubles[] = ['match_id' => $match_id, 'player_id' => $player_id];
}
$arr[$match_id][] = $player_id;
}
return view('filament.pages.list-doubles-player', ['doubles' => $doubles]);
}), }),
Action::make('truncate') Action::make('truncate')
->icon('phosphor-trash') ->icon('phosphor-trash')
@@ -1,16 +1,16 @@
<div> <div>
{{-- <div class="p-2 border text-md">Player missing {{ \count($players)}}</div> --}} {{-- <div class="p-2 border text-md">Player missing {{ \count($players)}}</div> --}}
<x-filament::section> <x-filament::section collapsible>
<x-slot name="heading"> <x-slot name="heading">
{{ \count($players)}} players in table "players" but missing in tavle "details" {{ \count($players)}} players in table "players" are missing in table "details"
</x-slot> </x-slot>
<div class= "flex flex-wrap gap-2"> <div class="block max-h-64 overflow-y-auto pr-2">
@foreach ($players as $player) <div class="space-y-">
@foreach ($players as $player)
<div>{{ $player->ss_player_id }}</div> {{ $player->ss_player_id }},
@endforeach
@endforeach </div>
</div> </div>
</x-filament::section> </x-filament::section>
</div> </div>