From 54bbb420ece1d5fe305296b775e9382833be017d Mon Sep 17 00:00:00 2001 From: salam Date: Thu, 22 Oct 2026 17:16:48 +0200 Subject: [PATCH] wip sudamerica comppa e ueva coppas --- app/Actions/LoadSofaScoreCategory.php | 2 ++ app/Actions/LoadStatisticFixturesLeaguesOptions.php | 2 ++ app/Actions/LoadStatisticFixturesMatchOptions.php | 9 +++++++-- app/Filament/Widgets/Boxes/Expectation1X2.php | 3 +-- .../Widgets/Charts/LoadEvents/LoadEventsQueryTP.php | 3 ++- 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/app/Actions/LoadSofaScoreCategory.php b/app/Actions/LoadSofaScoreCategory.php index d723cbd3..7a09f167 100644 --- a/app/Actions/LoadSofaScoreCategory.php +++ b/app/Actions/LoadSofaScoreCategory.php @@ -4,12 +4,14 @@ namespace App\Actions; use App\Models\SofaScoreTournament; use App\Models\StatisticFixtures; +use Illuminate\Support\Carbon; class LoadSofaScoreCategory { public static function load() { $league_ids = StatisticFixtures::where('sport_id', 1) + ->where('starttime', '>=', Carbon::now()) ->groupBy('league_id') ->pluck('league_id')->toArray(); diff --git a/app/Actions/LoadStatisticFixturesLeaguesOptions.php b/app/Actions/LoadStatisticFixturesLeaguesOptions.php index b66ba2f2..70aa520b 100644 --- a/app/Actions/LoadStatisticFixturesLeaguesOptions.php +++ b/app/Actions/LoadStatisticFixturesLeaguesOptions.php @@ -3,12 +3,14 @@ namespace App\Actions; use App\Models\StatisticFixtures; +use Illuminate\Support\Carbon; class LoadStatisticFixturesLeaguesOptions { public static function load(?int $sofascore_category_id = 0) { $res = StatisticFixtures::with('league') + ->where('starttime', '>=', Carbon::now()) ->whereHas('league', function ($query) use ($sofascore_category_id) { $query->where('sofa_score_category_id', $sofascore_category_id); }) diff --git a/app/Actions/LoadStatisticFixturesMatchOptions.php b/app/Actions/LoadStatisticFixturesMatchOptions.php index 5ad8d769..f4d595b9 100644 --- a/app/Actions/LoadStatisticFixturesMatchOptions.php +++ b/app/Actions/LoadStatisticFixturesMatchOptions.php @@ -4,6 +4,7 @@ namespace App\Actions; use App\Models\SofaScoreRosa; use App\Models\StatisticFixtures; +use Illuminate\Support\Carbon; class LoadStatisticFixturesMatchOptions { @@ -14,11 +15,15 @@ class LoadStatisticFixturesMatchOptions } $team_map = SofaScoreRosa::pluck('ss_team_name', 'ss_team_id')->toArray(); - $res = StatisticFixtures::where('league_id', $league_id)->get(); + $res = StatisticFixtures::where('league_id', $league_id) + ->where('starttime', '>=', Carbon::now()) + ->get(); $arr = []; foreach ($res as $val) { - $arr[$val->id] = $val->starttime->format('Y-m-d H:i').' - '.$team_map[$val->home_id].' vs '.$team_map[$val->away_id]; + if (isset($team_map[$val->home_id]) && isset($team_map[$val->away_id])) { + $arr[$val->id] = $val->starttime->format('Y-m-d H:i').' - '.$team_map[$val->home_id].' vs '.$team_map[$val->away_id]; + } } return $arr; diff --git a/app/Filament/Widgets/Boxes/Expectation1X2.php b/app/Filament/Widgets/Boxes/Expectation1X2.php index b390c5e4..be4aa325 100644 --- a/app/Filament/Widgets/Boxes/Expectation1X2.php +++ b/app/Filament/Widgets/Boxes/Expectation1X2.php @@ -10,12 +10,11 @@ class Expectation1X2 public static function load(array &$expectations, array $filter, object $match) { $team_id = (int) $filter['team_id'] ?? 0; - $home_id = $match->home_id; - $away_id = $match->away_id; $res_tp = LoadEventsQueryTP::load($filter, $match); $count_tp = $res_tp->count(); + $expectations['count_events'] = $count_tp; $expectations += ['win_count' => 0, 'draw_count' => 0, 'lost_count' => 0]; diff --git a/app/Filament/Widgets/Charts/LoadEvents/LoadEventsQueryTP.php b/app/Filament/Widgets/Charts/LoadEvents/LoadEventsQueryTP.php index e1762865..1bab32ba 100644 --- a/app/Filament/Widgets/Charts/LoadEvents/LoadEventsQueryTP.php +++ b/app/Filament/Widgets/Charts/LoadEvents/LoadEventsQueryTP.php @@ -5,6 +5,7 @@ namespace App\Filament\Widgets\Charts\LoadEvents; use App\Filament\Pages\Selections\Helper\GetSeason; use App\Models\StatistikoEvent; use App\Models\StatistikoPlayer; +use Illuminate\Support\Facades\Log; class LoadEventsQueryTP { @@ -97,7 +98,7 @@ class LoadEventsQueryTP /** * STATTISTIC DATA */ - // Log::debug('result', [$similar_past_matches, $home_id, $away_id, $team_id]); + Log::debug('result', [$similar_past_matches, $league_id, $team_id]); return StatistikoEvent::with('home')->with('away') ->where(function ($query) use ($league_id, $similar_past_matches) {