This commit is contained in:
salam committed 2026-10-12 22:42:32 +02:00
1 parent 4b2a1c1b01
commit f6f5dd0c7c
1 file changed
+9 -9
@@ -23,11 +23,11 @@ class LoadEventsQueryAll
} }
$ss_player_id = (int) $filter['ss_player_id'] ?? 0; $ss_player_id = (int) $filter['ss_player_id'] ?? 0;
$player_on_field = $filter['player_on_field'] ?? 'all'; $player_on_field = $filter['player_on_field'] ?? 'all';
$similar_past_matches = $filter['similar_past_matches']; $spm = $filter['similar_past_matches'];
$handicap_range = []; $handicap_range = [];
$total_range = []; $total_range = [];
if ($similar_past_matches != 'none') { if ($spm == 'league' or $spm == 'all') {
$ss_player_id = 0; $ss_player_id = 0;
$exp_handicap = $match->exp_away - $match->exp_home; $exp_handicap = $match->exp_away - $match->exp_home;
$exp_total = $match->exp_away + $match->exp_home; $exp_total = $match->exp_away + $match->exp_home;
@@ -81,18 +81,18 @@ class LoadEventsQueryAll
/** /**
* STATTISTIC DATA * STATTISTIC DATA
*/ */
// Log::debug('result', [$similar_past_matches, $team_id]); // Log::debug('result', [$spm, $team_id]);
return StatistikoEvent::with('home')->with('away') return StatistikoEvent::with('home')->with('away')
->where(function ($query) use ($league_id, $similar_past_matches) { ->where(function ($query) use ($league_id, $spm) {
switch ($similar_past_matches) { switch ($spm) {
case 'none': case 'none':
case 'league': case 'league':
return $query->where('league_id', $league_id); return $query->where('league_id', $league_id);
} }
}) })
->where(function ($query) use ($match, $similar_past_matches) { ->where(function ($query) use ($match, $spm) {
if ($similar_past_matches == 'none') { if ($spm == 'none') {
return $query return $query
->where('home_id', $match->home_id) ->where('home_id', $match->home_id)
->orWhere('home_id', '=', $match->away_id) ->orWhere('home_id', '=', $match->away_id)
@@ -117,8 +117,8 @@ class LoadEventsQueryAll
})->when($end, function ($query) use ($end) { })->when($end, function ($query) use ($end) {
return $query->whereDate('starttime', '<=', $end); return $query->whereDate('starttime', '<=', $end);
}) })
->when($season, function ($query) use ($season, $season_or_date, $similar_past_matches) { ->when($season, function ($query) use ($season, $season_or_date, $spm) {
if ($similar_past_matches == 'none' && $season_or_date == 'season') { if ($spm == 'none' && $season_or_date == 'season') {
return $query->whereIn('season', $season); return $query->whereIn('season', $season);
} }
}) })