use rocket::{get, routes, Route, State}; use rocket_dyn_templates::{context, Template}; use sqlx::SqlitePool; use crate::model::{ stat::{self, Stat}, user::{NonGuestUser, User}, }; use super::log::KioskCookie; #[get("/", rank = 2)] async fn index(db: &State, user: NonGuestUser) -> Template { let stat = Stat::get_rowed_km(db).await; let personal = stat::get_personal(db, &user.user).await; let kiosk = false; 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, show_kiosk_header: true)) } pub fn routes() -> Vec { routes![index, index_kiosk] } #[cfg(test)] mod test {}