fix ordering in leaderboard db queries for emeralds
@@ -200,10 +200,11 @@ class Database(commands.Cog):
async def fetch_leaderboard_balances(self, uids: list, *, limit: int = 10):
return (
await self.db.fetch(
- "SELECT uid, emeralds FROM users WHERE emeralds > 0 AND bot_banned = false ORDER BY emeralds LIMIT $1", limit
+ "SELECT uid, emeralds FROM users WHERE emeralds > 0 AND bot_banned = false ORDER BY emeralds DESC LIMIT $1",
+ limit,
),
await self.db.fetch(
- "SELECT uid, emeralds FROM users WHERE emeralds > 0 AND bot_banned = false AND uid = ANY($1::BIGINT[]) LIMIT $2",
+ "SELECT uid, emeralds FROM users WHERE emeralds > 0 AND bot_banned = false AND uid = ANY($1::BIGINT[]) ORDER BY emeralds DESC LIMIT $2",
uids,
limit,
),
