From dc8107d3e36d03caf1c6a4c5ec8c4ea06748104e Mon Sep 17 00:00:00 2001 From: furo Date: Sun, 7 Nov 2021 21:56:46 +0100 Subject: [PATCH] Feature both global and regional rank --- libs/database/wrapper.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libs/database/wrapper.js b/libs/database/wrapper.js index f20282d..c195969 100644 --- a/libs/database/wrapper.js +++ b/libs/database/wrapper.js @@ -242,10 +242,12 @@ export function leaderboardPoints(type, region, start, end) { SELECT rank, region, player, points FROM points WHERE type = ? AND region = ? ORDER BY rank ASC LIMIT ?, ${end}`) .all(type, region, start - 1) } + let rank = 1 for (const entry of leaderboard) { let flag = skinDB.prepare(`SELECT flag FROM skindata WHERE player = ?`).get(entry.player)?.flag ?? "default" - output.push({ rank: entry.rank, player: entry.player, points: entry.points, region: entry.region, flag: flag }) + output.push({ rank: rank, global: entry.rank, player: entry.player, points: entry.points, region: entry.region, flag: flag }) + ++i } return output }