diff --git a/app/Filament/Widgets/Boxes/ExpectationsTeam.php b/app/Filament/Widgets/Boxes/ExpectationsTeam.php index 0e92a431..cccbb3b2 100644 --- a/app/Filament/Widgets/Boxes/ExpectationsTeam.php +++ b/app/Filament/Widgets/Boxes/ExpectationsTeam.php @@ -30,6 +30,7 @@ class ExpectationsTeam } $res = LoadEventsQueryAll::load($filter, $match); + // dd($res); $res_tp = LoadEventsQueryTP::load($filter, $match); @@ -54,6 +55,7 @@ class ExpectationsTeam ExpectationCollecting::sort($similar_past_matches, $tmp, 'crn', $value->home_id, $value->away_id, $value->crn_h, $value->crn_a, $match); } + $expectations = ExpectationCalculation::calc($tmp); $expectations['gls']['name'] = 'Goals'; $expectations['fls']['name'] = 'Fouls'; diff --git a/app/Filament/Widgets/Charts/LoadEvents/LoadEventsQueryAll.php b/app/Filament/Widgets/Charts/LoadEvents/LoadEventsQueryAll.php index af6420c6..9195b551 100644 --- a/app/Filament/Widgets/Charts/LoadEvents/LoadEventsQueryAll.php +++ b/app/Filament/Widgets/Charts/LoadEvents/LoadEventsQueryAll.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 LoadEventsQueryAll { @@ -82,7 +83,7 @@ class LoadEventsQueryAll /** * STATTISTIC DATA */ - // Log::debug('result', [$similar_past_matches, $home_id, $away_id, $team_id]); + Log::debug('result', [$similar_past_matches, $team_id]); return StatistikoEvent::with('home')->with('away') ->where(function ($query) use ($league_id, $similar_past_matches) { @@ -92,10 +93,16 @@ class LoadEventsQueryAll return $query->where('league_id', $league_id); } }) - ->when($team_id, function ($query) use ($team_id, $player_on_field) { - return $query->where('home_id', '=', $team_id) - ->orWhere('away_id', '=', $team_id); + ->where(function ($query) use ($team_id, $similar_past_matches) { + if ($team_id && $similar_past_matches == 'none') { + return $query->where('home_id', '=', $team_id) + ->orWhere('away_id', '=', $team_id); + } }) + // ->when($team_id, function ($query) use ($team_id) { + // return $query->where('home_id', '=', $team_id) + // ->orWhere('away_id', '=', $team_id); + // }) ->when($matches_played, function ($query) use ($matches_played, $player_on_field) { if ($player_on_field == 'notplayed') { return $query->whereNotIn('match_id', $matches_played);