diff --git a/src/tera/log.rs b/src/tera/log.rs index 6c6442a..0e4c11d 100644 --- a/src/tera/log.rs +++ b/src/tera/log.rs @@ -84,7 +84,7 @@ async fn show(db: &State, user: User) -> Template { } #[get("/show")] -async fn show_kiosk(db: &State, _kios: KioskCookie) -> Template { +async fn show_kiosk(db: &State, _kiosk: KioskCookie) -> Template { let logs = Logbook::completed(db).await; Template::render("log.completed", context!(logs)) diff --git a/src/tera/stat.rs b/src/tera/stat.rs index 5dac834..54e0def 100644 --- a/src/tera/stat.rs +++ b/src/tera/stat.rs @@ -7,17 +7,30 @@ use crate::model::{ user::User, }; -#[get("/")] +use super::log::KioskCookie; + +#[get("/", rank = 2)] async fn index(db: &State, user: User) -> Template { let stat = Stat::get_rowed_km(db).await; let personal = stat::get_personal(db, &user).await; + let kiosk = false; - println!("{personal:?}"); - Template::render("stat", context!(loggedin_user: &user, stat, personal)) + Template::render( + "stat", + context!(loggedin_user: &user, stat, personal, kiosk), + ) +} + +#[get("/")] +async fn index_kiosk(db: &State, _kiosk: KioskCookie) -> Template { + let stat = Stat::get_rowed_km(db).await; + let kiosk = true; + + Template::render("stat", context!(stat, kiosk)) } pub fn routes() -> Vec { - routes![index] + routes![index, index_kiosk] } #[cfg(test)] diff --git a/templates/stat.html.tera b/templates/stat.html.tera index fb612fe..8eb910e 100644 --- a/templates/stat.html.tera +++ b/templates/stat.html.tera @@ -38,12 +38,14 @@