This commit is contained in:
salam committed 2026-05-23 17:14:58 +02:00
1 parent 789a6e699a
commit 27badf9140
3 files changed
+19 -3

No files matched your search

+2 -1
View File
@@ -153,7 +153,8 @@ class Statistic extends BaseDashboard
'all' => 'All',
'lineup' => 'Lineup',
'substituted' => 'Substituted',
]),
])
->live(),
Select::make('statistic_type')
->prefixIcon('phosphor-cell-signal-full')
->default('none')
@@ -14,7 +14,7 @@ class HelperMoveingAverage
$new = [];
$last = count($arr);
foreach ($arr as $key => $value) {
if ($key == 1) {
if ($key == 1 && $last > 2) {
$new[] = round(($arr[0] + $value + $arr[2]) / 3, 1);
} elseif ($key > 1 && $key < $last - 1) {
$new[] = round(($arr[$key - 1] + $value + $arr[$key + 1]) / 3, 1);
+16 -1
View File
@@ -33,6 +33,8 @@ class LoadEvents
$team_position = $filter['team_position'];
$player_on_field = $filter['player_on_field'];
if (! $league_id) {
return [];
}
@@ -49,7 +51,20 @@ class LoadEvents
$matches_played = 0;
$description = '';
if ($tm_player_id) {
$matches_played = StatistikoPlayer::where('tm_player_id', (int) $tm_player_id)->pluck('match_id')->toArray();
$matches_played = StatistikoPlayer::where('tm_player_id', (int) $tm_player_id)
->when($player_on_field, function ($query) use ($player_on_field) {
switch ($player_on_field) {
case 'lineup':
return $query->where('lineup', 'T');
case 'substituted':
return $query->where('lineup', 'P');
}
})
->pluck('match_id')->toArray();
if (! $matches_played) {
return [];
}
$description = ' (with '.StatistikoDetail::where('tm_player_id', (int) $tm_player_id)->value('name').')';
}