From 2f5d483bff1a246caf9327f7cf9ac2b928bedc63 Mon Sep 17 00:00:00 2001 From: Philipp Hofer Date: Thu, 17 Jul 2025 21:48:31 +0200 Subject: [PATCH] fix tests --- src/model/user/mod.rs | 2 +- src/tera/log.rs | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/model/user/mod.rs b/src/model/user/mod.rs index 21a702b..e51863c 100644 --- a/src/model/user/mod.rs +++ b/src/model/user/mod.rs @@ -431,7 +431,7 @@ WHERE family_id IS NULL; " SELECT id, name, pw, deleted, last_access, dob, weight, sex, member_since_date, birthdate, mail, nickname, phone, address, family_id, user_token FROM user -WHERE deleted = 0 AND (SELECT COUNT(*) FROM user_role WHERE user_id=user.id AND role_id = (SELECT id FROM role WHERE name = 'cox')) > 0 +WHERE deleted = 0 AND (SELECT COUNT(*) FROM user_role WHERE user_id=user.id AND role_id in (SELECT id FROM role WHERE name = 'cox' or name = 'Bootsführer')) > 0 ORDER BY last_access DESC " ) diff --git a/src/tera/log.rs b/src/tera/log.rs index 9a1542b..d6faa00 100644 --- a/src/tera/log.rs +++ b/src/tera/log.rs @@ -62,7 +62,8 @@ async fn index_loggedin( &UserWithDetails::from_user(user.into_inner(), db).await, ); - index(db, flash, context).await + let context = index(db, flash, context).await; + Template::render("log", context.into_json()) } #[get("/")] @@ -78,10 +79,11 @@ async fn index_kiosk( context.insert("show_kiosk_header", &true); - index(db, flash, context).await + let context = index(db, flash, context).await; + Template::render("kiosk", context.into_json()) } -async fn index(db: &SqlitePool, flash: Option>, mut context: Context) -> Template { +async fn index(db: &SqlitePool, flash: Option>, mut context: Context) -> Context { if let Some(msg) = flash { context.insert("flash", &msg.into_inner()); } @@ -120,7 +122,7 @@ async fn index(db: &SqlitePool, flash: Option>, mut context: Co context.insert("on_water", &on_water); context.insert("distances", &distances); - Template::render("kiosk", context.into_json()) + context } #[get("/show", rank = 3)]