fix: show only best score for each player
All checks were successful
deploy to cloudflare pages / deploy (push) Successful in 34s

This commit is contained in:
uku 2024-11-27 11:41:13 +01:00
parent 8e33400516
commit 219d590e71
Signed by: uku
SSH key fingerprint: SHA256:4P0aN6M8ajKukNi6aPOaX0LacanGYtlfjmN+m/sHY/o

View file

@ -10,7 +10,7 @@ export const GET: RequestHandler = async ({ url, platform }) => {
const { results } = await db
.prepare(
"SELECT game.id, game.total_score, user.name FROM game INNER JOIN user ON user.id = game.user_id WHERE game.mode = ? AND game.stops_type = ? ORDER BY game.total_score DESC, game.time ASC LIMIT 10",
"SELECT game.id, max(game.total_score) AS total_score, user.name FROM game INNER JOIN user ON user.id = game.user_id WHERE game.mode = ? AND game.stops_type = ? GROUP BY game.user_id ORDER BY game.total_score DESC, game.time ASC LIMIT 10",
)
.bind(options.mode, options.stopsType)
.all();