compute proper rank

This commit is contained in:
2025-08-02 20:18:11 +02:00
parent 4587998e91
commit bad6dab8e8

View File

@@ -9,12 +9,11 @@ pub(crate) struct Rank {
impl Backend { impl Backend {
pub(crate) async fn highscore(&self) -> Vec<Rank> { pub(crate) async fn highscore(&self) -> Vec<Rank> {
// TODO: proper rank calculation
match self { match self {
Backend::Sqlite(db) => sqlx::query_as!( Backend::Sqlite(db) => sqlx::query_as!(
Rank, Rank,
"SELECT "SELECT
1 as rank, RANK() OVER (ORDER BY COUNT(s.client_uuid) DESC) as rank,
c.name, c.name,
c.uuid, c.uuid,
COUNT(s.client_uuid) as amount COUNT(s.client_uuid) as amount