From b2d87f7c8bea7b5da54385fbfa99d5fb444def55 Mon Sep 17 00:00:00 2001 From: Vari Date: Sun, 14 Dec 2025 20:42:16 +0100 Subject: [PATCH] Fix for the leaderboard query not showing enough people below you when you are first, second or third place --- dist/app/Http/Controllers/Api/LeaderboardController.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dist/app/Http/Controllers/Api/LeaderboardController.php b/dist/app/Http/Controllers/Api/LeaderboardController.php index 9d22162..5283475 100644 --- a/dist/app/Http/Controllers/Api/LeaderboardController.php +++ b/dist/app/Http/Controllers/Api/LeaderboardController.php @@ -109,8 +109,7 @@ public static function getLeaderboardEntriesForPlayer(string|array $userId, Fact $mainQuery->where('rank', '<=', function (\Illuminate\Database\Query\Builder $whereQuery) use ($userId, $query) { $whereQuery->where('user_id', $userId); $whereQuery->fromSub($query, 'c'); - $whereQuery->selectRaw('(c.rank + 1)'); - + $whereQuery->selectRaw('(c.rank + (CASE c.rank WHEN 1 THEN 4 WHEN 2 THEN 3 WHEN 3 THEN 2 ELSE 1 END))'); }); } $mainQuery->orderByDesc('rank');