Feature both global and regional rank

This commit is contained in:
furo 2021-11-07 21:56:46 +01:00
parent 1b7dda805a
commit dc8107d3e3

View File

@ -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
}