compute proper rank
This commit is contained in:
@@ -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
|
||||||
|
Reference in New Issue
Block a user