use http_body_util::Full; use hyper::body::Bytes; use hyper::Response; use crate::controller::utils; use crate::controller::wallet::Wallet; use crate::db; use crate::templates; pub async fn get(wallet: &Wallet) -> Response> { let categories = db::categories::list(&wallet.pool).await; let payments = db::payments::list_for_stats(&wallet.pool).await; let incomes = db::incomes::total_each_month(&wallet.pool).await; let context = minijinja::context!( header => templates::Header::Statistics, connected_user => wallet.user, json_categories => serde_json::to_string(&categories).unwrap(), json_payments => serde_json::to_string(&payments).unwrap(), json_incomes => serde_json::to_string(&incomes).unwrap() ); utils::template( &wallet.assets, &wallet.templates, "statistics.html", context, ) }