Skip to content

Commit

Permalink
Fix highscores error
Browse files Browse the repository at this point in the history
  • Loading branch information
slawkens committed Nov 9, 2023
1 parent 9d119b6 commit a04fbde
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions system/pages/highscores.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@
$configHighscoresPerPage = setting('core.highscores_per_page');
$limit = $configHighscoresPerPage + 1;

$highscores = [];
$needReCache = true;
$cacheKey = 'highscores_' . $skill . '_' . $vocation . '_' . $page . '_' . $configHighscoresPerPage;

Expand All @@ -158,7 +159,7 @@
->selectRaw('accounts.country, players.id, players.name, players.account_id, players.level, players.vocation' . $outfit . $promotion)
->orderByDesc('value');

if (!isset($highscores) || empty($highscores)) {
if (empty($highscores)) {
if ($skill >= POT::SKILL_FIRST && $skill <= POT::SKILL_LAST) { // skills
if ($db->hasColumn('players', 'skill_fist')) {// tfs 1.0
$skill_ids = array(
Expand Down Expand Up @@ -201,16 +202,16 @@
$list = 'experience';
}
}
}

$highscores = $query->get()->map(function($row) {
$tmp = $row->toArray();
$tmp['online'] = $row->online_status;
$tmp['vocation'] = $row->vocation_name;
unset($tmp['online_table']);
$highscores = $query->get()->map(function($row) {
$tmp = $row->toArray();
$tmp['online'] = $row->online_status;
$tmp['vocation'] = $row->vocation_name;
unset($tmp['online_table']);

return $tmp;
})->toArray();
return $tmp;
})->toArray();
}

if ($cache->enabled() && $needReCache) {
$cache->set($cacheKey, serialize($highscores), setting('core.highscores_cache_ttl') * 60);
Expand Down

0 comments on commit a04fbde

Please sign in to comment.