Skip to content
Permalink
Browse files

0.77.9 Fix calculating player scores

  • Loading branch information...
brakerb committed Oct 2, 2019
1 parent f68238c commit 1dcf1e8fe7f3922a10da234b2b0b3ebb705c289a
Showing with 4 additions and 5 deletions.
  1. +4 −5 core/Modules/statistics/Statistics.php
@@ -114,14 +114,15 @@ function ($last_played) {
/**
* Calculate scores
*/
$start = time() + microtime(true);
$limit = config('locals.limit');
$data = DB::table('local-records')
->join('players', 'local-records.Player', '=', 'players.id')
->join('maps', 'local-records.Map', '=', 'maps.id')
->selectRaw('Player as id, Login, SUM(Rank) as rank_sum, COUNT(Rank) as locals')
->where('maps.enabled', '=', 1)
->whereIn('Login', $players->pluck('login'))
->groupBy('Login')
->get();
foreach ($data as $stat) {
@@ -132,10 +133,8 @@ function ($last_played) {
'Locals' => $stat->locals
]);
}
$end = time() + microtime(true);
Log::info(sprintf("Calculating player scores took %.3fs\n", $end - $start));
self::$totalRankedPlayers = $data->count();
self::$totalRankedPlayers = DB::table('stats')->where('Score', '>', 0)->count();
self::updatePlayerRanks($players);
}

0 comments on commit 1dcf1e8

Please sign in to comment.
You can’t perform that action at this time.