use rocket::{get, routes, Route, State}; use rocket_dyn_templates::{context, Template}; use sqlx::SqlitePool; use crate::model::{ stat::{self, Stat}, user::User, }; 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; 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, index_kiosk] } #[cfg(test)] mod test {}