diff --git a/src/model/stat.rs b/src/model/stat.rs index 5a167e3..488b602 100644 --- a/src/model/stat.rs +++ b/src/model/stat.rs @@ -1,5 +1,5 @@ use serde::Serialize; -use sqlx::{Row, FromRow, SqlitePool}; +use sqlx::{FromRow, Row, SqlitePool}; #[derive(FromRow, Serialize, Clone)] pub struct Stat { @@ -9,6 +9,7 @@ pub struct Stat { impl Stat { pub async fn get_rowed_km(db: &SqlitePool) -> Vec { + //TODO: switch to query! macro again (once upgraded to sqlite 3.42 on server) sqlx::query( "SELECT u.name AS name, COALESCE(SUM(distance_in_km), 0) as rowed_km FROM user u @@ -20,7 +21,7 @@ impl Stat { FROM logbook l INNER JOIN rower r ON r.logbook_id = l.id ) AS subquery ON u.id = subquery.user_id - GROUP BY u.id ORDER BY rowed_km DESC;" + GROUP BY u.id ORDER BY rowed_km DESC;", ) .fetch_all(db) .await