TP for boxes and grafic wip
This commit is contained in:
1 parent
1fbf53cf1f
commit
28882bfdb5
3 files changed
+28
-43
No files matched your search
@@ -48,19 +48,6 @@ class LoadEventsQueryAll
|
||||
$matches_played = [];
|
||||
|
||||
if ($ss_player_id) {
|
||||
// $matches_season = StatistikoEvent::whereIn('season', $season)
|
||||
// ->where(function ($query) use ($team_id, $team_position) {
|
||||
// switch ($team_position) {
|
||||
// case 'home':
|
||||
// return $query->where('home_id', '=', $team_id);
|
||||
// case 'away':
|
||||
// return $query->where('away_id', '=', $team_id);
|
||||
// default:
|
||||
// return $query->where('home_id', '=', $team_id)
|
||||
// ->orWhere('away_id', '=', $team_id);
|
||||
// }
|
||||
// })->pluck('match_id')->toArray();
|
||||
|
||||
$matches_season = StatistikoEvent::whereIn('season', $season)
|
||||
->where(function ($query) use ($team_id) {
|
||||
return $query->where('home_id', '=', $team_id)
|
||||
@@ -111,19 +98,6 @@ class LoadEventsQueryAll
|
||||
return $query->where('home_id', '=', $team_id)
|
||||
->orWhere('away_id', '=', $team_id);
|
||||
})
|
||||
// ->where(function ($query) use ($team_id, $similar_past_matches, $team_position) {
|
||||
// if ($team_id && $similar_past_matches == 'none') {
|
||||
// switch ($team_position) {
|
||||
// case 'home':
|
||||
// return $query->where('home_id', '=', $team_id);
|
||||
// case 'away':
|
||||
// return $query->where('away_id', '=', $team_id);
|
||||
// default:
|
||||
// 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);
|
||||
|
||||
+17
-10
@@ -6,7 +6,7 @@ use App\Filament\Pages\Selections\Helper\GetSeason;
|
||||
use App\Models\StatistikoEvent;
|
||||
use App\Models\StatistikoPlayer;
|
||||
|
||||
class LoadEventsQuerySPM
|
||||
class LoadEventsQueryTP
|
||||
{
|
||||
public static function load(array $filter, object $match)
|
||||
{
|
||||
@@ -26,8 +26,6 @@ class LoadEventsQuerySPM
|
||||
$player_on_field = $filter['player_on_field'] ?? 'all';
|
||||
$similar_past_matches = $filter['similar_past_matches'];
|
||||
$team_position = $filter['team_position'];
|
||||
$home_id = $match->home_id;
|
||||
$away_id = $match->away_id;
|
||||
|
||||
$handicap_range = [];
|
||||
$total_range = [];
|
||||
@@ -63,6 +61,12 @@ class LoadEventsQuerySPM
|
||||
}
|
||||
})->pluck('match_id')->toArray();
|
||||
|
||||
$matches_season = StatistikoEvent::whereIn('season', $season)
|
||||
->where(function ($query) use ($team_id) {
|
||||
return $query->where('home_id', '=', $team_id)
|
||||
->orWhere('away_id', '=', $team_id);
|
||||
})->pluck('match_id')->toArray();
|
||||
|
||||
$matches_played = StatistikoPlayer::query()
|
||||
->whereIn('match_id', $matches_season)
|
||||
->where('ss_player_id', $ss_player_id)
|
||||
@@ -103,13 +107,16 @@ class LoadEventsQuerySPM
|
||||
return $query->where('league_id', $league_id);
|
||||
}
|
||||
})
|
||||
->where(function ($query) use ($team_id, $home_id, $away_id, $similar_past_matches) {
|
||||
if ($similar_past_matches == 'none') {
|
||||
if ($team_id) {
|
||||
return $query->orWhere('home_id', $team_id)
|
||||
->orWhere('away_id', '=', $team_id);
|
||||
} else {
|
||||
return $query->whereIn('home_id', [$home_id, $away_id])->orWhereIn('away_id', [$home_id, $away_id]);
|
||||
->where(function ($query) use ($team_id, $similar_past_matches, $team_position) {
|
||||
if ($team_id && $similar_past_matches == 'none') {
|
||||
switch ($team_position) {
|
||||
case 'home':
|
||||
return $query->where('home_id', '=', $team_id);
|
||||
case 'away':
|
||||
return $query->where('away_id', '=', $team_id);
|
||||
default:
|
||||
return $query->where('home_id', '=', $team_id)
|
||||
->orWhere('away_id', '=', $team_id);
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in new issue
Block a user