diff --git a/app/Filament/Pages/Selections/LoadSeasons.php b/app/Filament/Pages/Selections/LoadSeasons.php index b2dc3688..c12ef7c0 100644 --- a/app/Filament/Pages/Selections/LoadSeasons.php +++ b/app/Filament/Pages/Selections/LoadSeasons.php @@ -7,13 +7,25 @@ use App\Models\StatistikoEvent; class LoadSeasons { - public static function load($league_id) + public static function load($sofascore_category_id) { - if(!$league_id){ + if(!$sofascore_category_id){ return []; } - return StatistikoEvent::query()->where('league_id', $league_id)->groupBy('season')->pluck('season','season')->toArray(); + $season_mode = SofaScoreCategory::where('id', $sofascore_category_id)->value('season_mode'); + $arr = []; + if($season_mode == 'fullyear') { + $arr[2024] = 2024; + $arr[2025] = 2025; + $arr[2026] = 2026; + }else { + $arr['24/25'] = '24/25'; + $arr['25/26'] = '25/26'; + $arr['26/27'] = '26/27'; + } + + return $arr; } } diff --git a/app/Filament/Pages/Statistic.php b/app/Filament/Pages/Statistic.php index f412ff14..fade22ff 100644 --- a/app/Filament/Pages/Statistic.php +++ b/app/Filament/Pages/Statistic.php @@ -346,7 +346,6 @@ class Statistic extends BaseDashboard Select::make('season') ->live() ->columns(2) - ->searchable(false) ->hiddenLabel() ->multiple() ->placeholder('Current Season') @@ -355,7 +354,7 @@ class Statistic extends BaseDashboard ->hidden(fn (Get $get) => $get('season_or_date') == 'date') ->prefixIcon('phosphor-calendar-star-fill') ->options(function (Get $get) { - return LoadSeasons::load($get('league_id')); + return LoadSeasons::load($get('sofascore_category_id')); }) ->afterStateUpdated(function (callable $set) { $set('ss_player_id', null); diff --git a/app/Filament/Widgets/Data/LoadEvents.php b/app/Filament/Widgets/Data/LoadEvents.php index 15463e19..2dfd3643 100644 --- a/app/Filament/Widgets/Data/LoadEvents.php +++ b/app/Filament/Widgets/Data/LoadEvents.php @@ -51,6 +51,8 @@ class LoadEvents if ($similar_past_matches != 'none') { + $team_id = 0; + $team_position = ''; $exp_handicap = $match->exp_away - $match->exp_home; @@ -238,6 +240,20 @@ class LoadEvents $labels[] = round($value['starttime']->diffInDays(Carbon::now())); + switch ($value['result_code']) { + case '1': + $results['w']++; + $results['l2']++; + break; + case 'X': + $results['d']++; + break; + case '2': + $results['l']++; + $results['w2']++; + break; + } + // Home playing HOME done and commited if ($match->home_id == $value['home_id']) { $dataset_home[] = (int) $value['val_home']; diff --git a/app/Filament/Widgets/Data/LoadEvents/LoadEventsQuery.php b/app/Filament/Widgets/Data/LoadEvents/LoadEventsQuery.php index e9025d1a..fe73067b 100644 --- a/app/Filament/Widgets/Data/LoadEvents/LoadEventsQuery.php +++ b/app/Filament/Widgets/Data/LoadEvents/LoadEventsQuery.php @@ -33,6 +33,10 @@ class LoadEventsQuery $statistic_type = 'gls'; } + // if($similar_past_matches != 'none'){ + // $team_id = 0; + // } + $season = GetSeason::load($season, $sofascore_category_id); // dd($season); @@ -81,6 +85,7 @@ class LoadEventsQuery } } + // dd($handicap_range, $total_range); /** * STATTISTIC DATA */ @@ -114,19 +119,21 @@ class LoadEventsQuery return $query->whereBetween('exp_handicap', $handicap_range); })->when($total_range, function ($query) use ($total_range) { return $query->whereBetween('exp_total', $total_range); - })->when($start, function ($query) use ($start) { + }) + ->when($start, function ($query) use ($start) { return $query->whereDate('starttime', '>=', $start); })->when($end, function ($query) use ($end) { return $query->whereDate('starttime', '<=', $end); }) - ->when($season, function ($query) use ($season, $season_or_date) { - if ($season_or_date == 'season') { - return $query->whereIn('season', $season); - } - }) + // ->when($season, function ($query) use ($season, $season_or_date) { + // if ($season_or_date == 'season') { + // return $query->whereIn('season', $season); + // } + // }) ->orderBy('starttime', 'ASC') ->get(); + // dd($res); // dd($season, $team_id, $home_id, $away_id, $res); $arr = [];