From bad6dab8e8c19c592961cc2a6bbed6b319adffaa Mon Sep 17 00:00:00 2001 From: Philipp Hofer Date: Sat, 2 Aug 2025 20:18:11 +0200 Subject: [PATCH] compute proper rank --- src/model/highscore.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/model/highscore.rs b/src/model/highscore.rs index 9749674..d980dec 100644 --- a/src/model/highscore.rs +++ b/src/model/highscore.rs @@ -9,12 +9,11 @@ pub(crate) struct Rank { impl Backend { pub(crate) async fn highscore(&self) -> Vec { - // TODO: proper rank calculation match self { Backend::Sqlite(db) => sqlx::query_as!( Rank, "SELECT - 1 as rank, + RANK() OVER (ORDER BY COUNT(s.client_uuid) DESC) as rank, c.name, c.uuid, COUNT(s.client_uuid) as amount