wup
This commit is contained in:
1 parent
c2f068e8bf
commit
436a8ec142
8 files changed
+158
-86
No files matched your search
@@ -14,15 +14,24 @@ class AverageTeamSeason
|
||||
public static function load(array &$expectations, array $filter, object $match)
|
||||
{
|
||||
$tournament_id = (int) $filter['league_id'] ?? 0;
|
||||
$team_position = $filter['team_position'];
|
||||
$team_id = (int) $filter['team_id'] ?? 0;
|
||||
$seasonmode = $filter['seasonmode'];
|
||||
$active_season = GetSeason::active($seasonmode);
|
||||
$season = GetSeason::active($seasonmode);
|
||||
|
||||
$res = StatistikoEvent::where('league_id', $tournament_id)
|
||||
->when($active_season, function ($query) use ($active_season) {
|
||||
return $query->where('season', $active_season);
|
||||
})->when($team_id, function ($query) use ($team_id) {
|
||||
return $query->orWhere('home_id', $team_id)->orWhere('away_id', '=', $team_id);
|
||||
->when($season, function ($query) use ($season) {
|
||||
return $query->where('season', $season);
|
||||
})->when($team_id, function ($query) use ($team_position, $team_id) {
|
||||
switch ($team_position) {
|
||||
case 'home':
|
||||
return $query->where('home_id', $team_id);
|
||||
case 'away':
|
||||
return $query->where('away_id', $team_id);
|
||||
default:
|
||||
return $query->orWhere('home_id', $team_id)
|
||||
->orWhere('away_id', '=', $team_id);
|
||||
}
|
||||
})->get();
|
||||
|
||||
if ($res) {
|
||||
@@ -30,13 +39,41 @@ class AverageTeamSeason
|
||||
$result = [];
|
||||
|
||||
foreach ($res as $val) {
|
||||
ExpectationAverage::filter($result, 'team', 'gls', $val->gls_a, $val->gls_h);
|
||||
ExpectationAverage::filter($result, 'team', 'crn', $val->crn_a, $val->crn_h);
|
||||
ExpectationAverage::filter($result, 'team', 'fls', $val->fls_a, $val->fls_h);
|
||||
ExpectationAverage::filter($result, 'team', 'ofs', $val->ofs_a, $val->ofs_h);
|
||||
ExpectationAverage::filter($result, 'team', 'crd', $val->crd_a, $val->crd_h);
|
||||
ExpectationAverage::filter($result, 'team', 'snt', $val->snt_a, $val->snt_h);
|
||||
ExpectationAverage::filter($result, 'team', 'tsh', $val->tsh_a, $val->tsh_h);
|
||||
if ($team_position == 'home' && $team_id == $val->home_id) {
|
||||
ExpectationAverage::filter($result, 'team', 'gls', $val->gls_h, $val->gls_a);
|
||||
ExpectationAverage::filter($result, 'team', 'crn', $val->crn_h, $val->crn_a);
|
||||
ExpectationAverage::filter($result, 'team', 'fls', $val->fls_h, $val->fls_a);
|
||||
ExpectationAverage::filter($result, 'team', 'ofs', $val->ofs_h, $val->ofs_a);
|
||||
ExpectationAverage::filter($result, 'team', 'crd', $val->crd_h, $val->crd_a);
|
||||
ExpectationAverage::filter($result, 'team', 'snt', $val->snt_h, $val->snt_a);
|
||||
ExpectationAverage::filter($result, 'team', 'tsh', $val->tsh_h, $val->tsh_a);
|
||||
} elseif ($team_position == 'away' && $team_id == $val->away_id) {
|
||||
ExpectationAverage::filter($result, 'team', 'gls', $val->gls_a, $val->gls_h);
|
||||
ExpectationAverage::filter($result, 'team', 'crn', $val->crn_a, $val->crn_h);
|
||||
ExpectationAverage::filter($result, 'team', 'fls', $val->fls_a, $val->fls_h);
|
||||
ExpectationAverage::filter($result, 'team', 'ofs', $val->ofs_a, $val->ofs_h);
|
||||
ExpectationAverage::filter($result, 'team', 'crd', $val->crd_a, $val->crd_h);
|
||||
ExpectationAverage::filter($result, 'team', 'snt', $val->snt_a, $val->snt_h);
|
||||
ExpectationAverage::filter($result, 'team', 'tsh', $val->tsh_a, $val->tsh_h);
|
||||
} else {
|
||||
if ($team_id == $val->home_id) {
|
||||
ExpectationAverage::filter($result, 'team', 'gls', $val->gls_h, $val->gls_a);
|
||||
ExpectationAverage::filter($result, 'team', 'crn', $val->crn_h, $val->crn_a);
|
||||
ExpectationAverage::filter($result, 'team', 'fls', $val->fls_h, $val->fls_a);
|
||||
ExpectationAverage::filter($result, 'team', 'ofs', $val->ofs_h, $val->ofs_a);
|
||||
ExpectationAverage::filter($result, 'team', 'crd', $val->crd_h, $val->crd_a);
|
||||
ExpectationAverage::filter($result, 'team', 'snt', $val->snt_h, $val->snt_a);
|
||||
ExpectationAverage::filter($result, 'team', 'tsh', $val->tsh_h, $val->tsh_a);
|
||||
} elseif ($team_id == $val->away_id) {
|
||||
ExpectationAverage::filter($result, 'team', 'gls', $val->gls_a, $val->gls_h);
|
||||
ExpectationAverage::filter($result, 'team', 'crn', $val->crn_a, $val->crn_h);
|
||||
ExpectationAverage::filter($result, 'team', 'fls', $val->fls_a, $val->fls_h);
|
||||
ExpectationAverage::filter($result, 'team', 'ofs', $val->ofs_a, $val->ofs_h);
|
||||
ExpectationAverage::filter($result, 'team', 'crd', $val->crd_a, $val->crd_h);
|
||||
ExpectationAverage::filter($result, 'team', 'snt', $val->snt_a, $val->snt_h);
|
||||
ExpectationAverage::filter($result, 'team', 'tsh', $val->tsh_a, $val->tsh_h);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$bets = ['gls', 'crn', 'fls', 'ofs', 'crd', 'snt', 'tsh'];
|
||||
@@ -58,7 +95,7 @@ class AverageTeamSeason
|
||||
$expectations['crd_team_season']['name'] = 'Cards';
|
||||
$expectations['snt_team_season']['name'] = 'Shots on Target';
|
||||
$expectations['tsh_team_season']['name'] = 'Total Shots';
|
||||
$expectations['active_season'] = $active_season;
|
||||
$expectations['active_season'] = $season;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user