wip player performance

This commit is contained in:
salam committed 2026-06-02 15:39:50 +02:00
1 parent fcbf718492
commit 37d28eec21
12 files changed
+214 -207

No files matched your search

+15 -9
View File
@@ -13,6 +13,8 @@ class StatsMedianAverage extends StatsOverviewWidget
{
protected ?string $pollingInterval = null;
protected int|array|null $columns = null;
#[Reactive]
public ?array $filters = [];
@@ -21,19 +23,18 @@ class StatsMedianAverage extends StatsOverviewWidget
$this->filters = $filters;
}
public function getColumns(): int|array
{
return [
'default' => 2,
'sm' => 3,
'xl' => 6,
];
}
protected function getStats(): array
{
$data = LoadEvents::load($this->filters);
// dd($data);
$this->columns = [
'default' => 2,
'sm' => 3,
'xl' => ! isset($data['similar_past_matches']) || $data['similar_past_matches'] == 'none' ? 6 : 3,
];
$statistic_type = ucfirst(HelperStatisticType::get($this->filters));
if (! isset($data['datasets'][0])) {
@@ -86,6 +87,7 @@ class StatsMedianAverage extends StatsOverviewWidget
Stat::make('stat1', 'stat1')->view('filament.resources.events.widgets.statistic-regular', [
'titel' => 'Number of events',
'value' => $total_home,
'hidden' => false,
]),
Stat::make('stat2', 'stat2')->view('filament.resources.events.widgets.statistic-average', [
'titel' => 'Average '.$statistic_type,
@@ -101,17 +103,21 @@ class StatsMedianAverage extends StatsOverviewWidget
'home' => $home_team,
'away' => $away_team,
]),
Stat::make('stat4', 'stat4')->view('filament.resources.events.widgets.statistic-regular', [
'titel' => 'Win: '.$data['results']['w'],
'value' => $win,
'hidden' => $data['similar_past_matches'] == 'none' ? false : true,
]),
Stat::make('stat5', 'stat5')->view('filament.resources.events.widgets.statistic-regular', [
'titel' => 'Draw: '.$data['results']['d'],
'value' => $draw,
'hidden' => $data['similar_past_matches'] == 'none' ? false : true,
]),
Stat::make('stat6', 'stat6')->view('filament.resources.events.widgets.statistic-regular', [
'titel' => 'Lost: '.$data['results']['l'],
'value' => $lost,
'hidden' => $data['similar_past_matches'] == 'none' ? false : true,
]),
];
}