From 7ebbf5661aff154e82ac69e1bf9a3d6d329ce411 Mon Sep 17 00:00:00 2001 From: philipp Date: Sun, 14 Apr 2024 20:20:22 +0200 Subject: [PATCH] don't show external boats in boatstat; hide logout in menu; move owner into own column in boatstat --- src/model/stat.rs | 6 ++-- templates/includes/macros.html.tera | 55 ++++++++++------------------- templates/stat.boats.html.tera | 2 ++ 3 files changed, 24 insertions(+), 39 deletions(-) diff --git a/src/model/stat.rs b/src/model/stat.rs index 7199ce8..e738a3e 100644 --- a/src/model/stat.rs +++ b/src/model/stat.rs @@ -17,6 +17,7 @@ pub struct BoatStat { pub struct SingleBoatStat { name: String, location: String, + owner: String, years: HashMap, } @@ -39,7 +40,7 @@ LEFT JOIN LEFT JOIN location ON boat.location_id = location.id WHERE - boat.name != 'Externes Boot' + boat.name != 'Externes Boot' AND not boat.external GROUP BY boat.id, year ORDER BY @@ -58,7 +59,7 @@ ORDER BY } else { String::from("Verein") }; - let name = format!("{} ({})", boat.name, owner); + let name = boat.name.clone(); let location: String = row.get("location"); let year: i32 = row.get("year"); if year == 0 { @@ -78,6 +79,7 @@ ORDER BY .or_insert(SingleBoatStat { name, location, + owner, years: HashMap::new(), }); boat_stat.years.insert(year, rowed_km); diff --git a/templates/includes/macros.html.tera b/templates/includes/macros.html.tera index 9caa809..42c9583 100644 --- a/templates/includes/macros.html.tera +++ b/templates/includes/macros.html.tera @@ -34,23 +34,6 @@
- {% if "scheckbuch" in loggedin_user.roles and loggedin_user.weight and loggedin_user.sex and loggedin_user.dob %} - - {% include "includes/book" %} - Ergo - - - {% endif %} - {% if "scheckbuch" not in loggedin_user.roles %} - {% endif %} - - Ergo + {% endif %} + {% if "admin" in loggedin_user.roles or "Vorstand" in loggedin_user.roles %} + Userverwaltung + {% endif %} + {% if "admin" in loggedin_user.roles %} + Boote + {% endif %} + Ausloggen - - Ausloggen - + +
+ diff --git a/templates/stat.boats.html.tera b/templates/stat.boats.html.tera index d9c3af7..5c6a0d4 100644 --- a/templates/stat.boats.html.tera +++ b/templates/stat.boats.html.tera @@ -9,6 +9,7 @@ Name + Eigentümer Ort {% for year in stat.pot_years | sort | reverse %}{{ year }}{% endfor %} @@ -17,6 +18,7 @@ {% for boat in stat.boats %} {{ boat.name }} + {{ boat.owner }} {{ boat.location }} {% for year in stat.pot_years | sort | reverse %} -- 2.45.2