wip player filter
This commit is contained in:
1 parent
12d29c7b3e
commit
74e9285bac
4 files changed
+30
-21
No files matched your search
@@ -3,7 +3,6 @@
|
||||
namespace App\Filament\Widgets\Data;
|
||||
|
||||
use App\Filament\Widgets\Data\LoadEvents\LoadEventsAverages;
|
||||
use App\Models\CompetitionGroup;
|
||||
use App\Models\StatisticFixtures;
|
||||
use App\Models\StatistikoDetail;
|
||||
use App\Models\StatistikoEvent;
|
||||
@@ -12,16 +11,8 @@ use Illuminate\Support\Carbon;
|
||||
|
||||
class LoadEvents
|
||||
{
|
||||
public static $last_query = [];
|
||||
|
||||
public static function load(array $filter, bool $hasdots)
|
||||
{
|
||||
// dd($filter);
|
||||
|
||||
// if (self::$last_query) {
|
||||
// return self::$last_query;
|
||||
// }
|
||||
|
||||
$league_id = (int) $filter['league_id'] ?? 0;
|
||||
|
||||
$match_id = (int) $filter['match_id'] ?? 0;
|
||||
@@ -42,7 +33,7 @@ class LoadEvents
|
||||
|
||||
$team_position = $filter['team_position'];
|
||||
|
||||
$player_on_field = $filter['player_on_field'];
|
||||
$player_on_field = $filter['player_on_field'] ?? 'all';
|
||||
|
||||
$accuracy = (float) $filter['accuracy'] ?? 0.5;
|
||||
|
||||
@@ -108,11 +99,19 @@ class LoadEvents
|
||||
if ($tm_player_id) {
|
||||
$matches_played = StatistikoPlayer::where('tm_player_id', (int) $tm_player_id)
|
||||
->when($player_on_field, function ($query) use ($player_on_field) {
|
||||
// 'all' => 'All',
|
||||
// 'lineup' => 'Lineup',
|
||||
// 'substituted' => 'Substituted',
|
||||
// 'notplayed' => 'Not Played',
|
||||
switch ($player_on_field) {
|
||||
case 'all':
|
||||
return $query->where('match_id', '>', 0);
|
||||
case 'lineup':
|
||||
return $query->where('lineup', 'T');
|
||||
case 'substituted':
|
||||
return $query->where('lineup', 'P');
|
||||
case 'notplayed':
|
||||
return $query->where('lineup', '=', '');
|
||||
}
|
||||
})
|
||||
->pluck('match_id')->toArray();
|
||||
@@ -519,8 +518,6 @@ class LoadEvents
|
||||
LoadEventsAverages::load($data, $filter, $labels, $events);
|
||||
}
|
||||
|
||||
self::$last_query = $data;
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user