This commit is contained in:
salam committed 2026-07-26 06:47:39 +02:00
1 parent bf48caa395
commit 4c29a38bcd
2 files changed
+26 -10

No files matched your search

+17 -6
View File
@@ -115,7 +115,10 @@ class LoadPerformance
$res = StatistikoPlayer::whereIn('match_id', $away_matches)->select('match_id', 'minutes_played', 'playerrating_value', 'player_position')->get();
$aways = self::filterMatches($res, $away_matches);
$length = max(count($homes['all']), count($aways['all']));
$c_home = isset($homes['all']) ? count($homes['all']) : 0;
$c_away = isset($aways['all']) ? count($aways['all']) : 0;
$length = max($c_home, $c_away);
self::shortenEnding($labels, $homes, $aways);
$home_av = self::makeAv($homes, $length);
@@ -543,12 +546,20 @@ class LoadPerformance
return $ret;
}
public static function leagueAv(array &$arr, $len)
public static function leagueAv(array &$arr, int $len)
{
$all = array_sum($arr['all']) / count($arr['all']);
$def = array_sum($arr['def']) / count($arr['def']);
$mid = array_sum($arr['mid']) / count($arr['mid']);
$att = array_sum($arr['att']) / count($arr['att']);
if (isset($arr['all'])) {
$all = array_sum($arr['all']) / count($arr['all']);
$def = array_sum($arr['def']) / count($arr['def']);
$mid = array_sum($arr['mid']) / count($arr['mid']);
$att = array_sum($arr['att']) / count($arr['att']);
} else {
$all = 0;
$def = 0;
$mid = 0;
$att = 0;
}
$ret = [];
$ret['all'] = array_fill(0, $len, round($all, 2));
$ret['def'] = array_fill(0, $len, round($def, 2));