wip
This commit is contained in:
1 parent
bf48caa395
commit
4c29a38bcd
2 files changed
+26
-10
No files matched your search
@@ -3,6 +3,7 @@
|
|||||||
namespace App\Console\Commands\Grapper\Sofascore;
|
namespace App\Console\Commands\Grapper\Sofascore;
|
||||||
|
|
||||||
use App\Models\StatistikoEvent;
|
use App\Models\StatistikoEvent;
|
||||||
|
use App\Models\StatistikoPlayer;
|
||||||
use App\Utilities\Notice;
|
use App\Utilities\Notice;
|
||||||
|
|
||||||
class SqlMover
|
class SqlMover
|
||||||
@@ -10,18 +11,22 @@ class SqlMover
|
|||||||
public static function run()
|
public static function run()
|
||||||
{
|
{
|
||||||
// $ligas = [649, 242, 20, 40, 325, 41];
|
// $ligas = [649, 242, 20, 40, 325, 41];
|
||||||
$ligas = [5, 9, 19, 26, 13, 99];
|
// $ligas = [5, 9, 19, 26, 13, 99];
|
||||||
|
$ligas = [22, 26, 28, 29, 33, 51];
|
||||||
|
|
||||||
Notice::note('SqlMover', 'b');
|
Notice::note('SqlMover', 'b');
|
||||||
|
|
||||||
foreach ($ligas as $liga_id) {
|
foreach ($ligas as $liga_id) {
|
||||||
|
|
||||||
$res = StatistikoEvent::where('league_id', $liga_id)->pluck('match_id');
|
Notice::note($liga_id, 'b');
|
||||||
|
|
||||||
dd($res);
|
$res = StatistikoEvent::where('league_id', $liga_id)
|
||||||
|
->where('season', '2026')
|
||||||
|
->pluck('match_id');
|
||||||
|
|
||||||
foreach ($res as $match_id) {
|
foreach ($res as $match_id) {
|
||||||
dd($match_id);
|
StatistikoEvent::where('match_id', $match_id)->delete();
|
||||||
|
StatistikoPlayer::where('match_id', $match_id)->delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -115,7 +115,10 @@ class LoadPerformance
|
|||||||
$res = StatistikoPlayer::whereIn('match_id', $away_matches)->select('match_id', 'minutes_played', 'playerrating_value', 'player_position')->get();
|
$res = StatistikoPlayer::whereIn('match_id', $away_matches)->select('match_id', 'minutes_played', 'playerrating_value', 'player_position')->get();
|
||||||
$aways = self::filterMatches($res, $away_matches);
|
$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);
|
self::shortenEnding($labels, $homes, $aways);
|
||||||
$home_av = self::makeAv($homes, $length);
|
$home_av = self::makeAv($homes, $length);
|
||||||
@@ -543,12 +546,20 @@ class LoadPerformance
|
|||||||
return $ret;
|
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']);
|
if (isset($arr['all'])) {
|
||||||
$def = array_sum($arr['def']) / count($arr['def']);
|
$all = array_sum($arr['all']) / count($arr['all']);
|
||||||
$mid = array_sum($arr['mid']) / count($arr['mid']);
|
$def = array_sum($arr['def']) / count($arr['def']);
|
||||||
$att = array_sum($arr['att']) / count($arr['att']);
|
$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 = [];
|
||||||
$ret['all'] = array_fill(0, $len, round($all, 2));
|
$ret['all'] = array_fill(0, $len, round($all, 2));
|
||||||
$ret['def'] = array_fill(0, $len, round($def, 2));
|
$ret['def'] = array_fill(0, $len, round($def, 2));
|
||||||
|
|||||||
Reference in new issue
Block a user