From 290e05dc4cdab24852aaa0c7fc150df0d9bb8b63 Mon Sep 17 00:00:00 2001 From: philipp Date: Mon, 24 Jul 2023 21:17:51 +0200 Subject: [PATCH] add todo --- src/model/stat.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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