From 94520e13a7f1bf45e94b4f28ea37f3703763baf7 Mon Sep 17 00:00:00 2001 From: Joris Guyonvarch Date: Sat, 18 Apr 2026 11:29:15 +0200 Subject: Show date for balancings --- src/db/balancing.rs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'src/db/balancing.rs') diff --git a/src/db/balancing.rs b/src/db/balancing.rs index 1641b97..8914eef 100644 --- a/src/db/balancing.rs +++ b/src/db/balancing.rs @@ -12,15 +12,6 @@ fn row_to_balancing(row: &Row) -> Result { }) } -fn row_to_table_row(row: &Row) -> Result { - Ok(TableRow { - id: row.get(0)?, - source: row.get(1)?, - destination: row.get(2)?, - amount: row.get(3)?, - }) -} - pub async fn count(conn: &Connection) -> i64 { let query = r#" SELECT COUNT(*) @@ -49,6 +40,7 @@ pub async fn list_for_table(conn: &Connection, page: i64, per_page: i64) -> Vec< let query = r#" SELECT balancing.id, + strftime('%d/%m/%Y', balancing.created_at), users_src.name, users_dest.name, balancing.amount @@ -67,7 +59,14 @@ pub async fn list_for_table(conn: &Connection, page: i64, per_page: i64) -> Vec< stmt.query_map( named_params![":limit": per_page, ":offset": (page - 1) * per_page], - row_to_table_row + |row: &Row| + Ok(TableRow { + id: row.get(0)?, + date: row.get(1)?, + source: row.get(2)?, + destination: row.get(3)?, + amount: row.get(4)?, + }) )? .collect::, _>>() }) -- cgit v1.2.3