From 39ba7d53ddf9006ee45c3ab922187e7bc1ecdf59 Mon Sep 17 00:00:00 2001 From: philipp Date: Sat, 6 Apr 2024 17:44:05 +0200 Subject: [PATCH 1/2] make table readable --- templates/stat.boats.html.tera | 64 ++++++++++++++++++++++++---------- 1 file changed, 46 insertions(+), 18 deletions(-) diff --git a/templates/stat.boats.html.tera b/templates/stat.boats.html.tera index b75eb1b..0aed44d 100644 --- a/templates/stat.boats.html.tera +++ b/templates/stat.boats.html.tera @@ -1,24 +1,44 @@ {% import "includes/macros" as macros %} {% extends "base" %} {% block content %} +

Bootsauswertung

- - - - - - {% for year in stat.pot_years | sort | reverse %}{% endfor %} - - - - {% for boat in stat.boats %} +
+
NameOrt{{ year }}
+ - - - {% for year in stat.pot_years | sort | reverse %} - + + {% for year in stat.pot_years | sort | reverse %}{% endfor %} + + + + {% for boat in stat.boats %} + + + + {% for year in stat.pot_years | sort | reverse %} + {% endfor %} @@ -26,6 +46,14 @@
{{ boat.name }}{{ boat.location }} - {% if year~'' in boat.years %}{{ boat.years[year] }}{% endif %} + NameOrt{{ year }}
{{ boat.name }}{{ boat.location }} + {% if year~'' in boat.years %} + {{ boat.years[year] }} + {% else %} + 0 + {% endif %}
- - - {% endblock content %} + + + +{% endblock content %} From c094097af7689068760a5b8abc27aff88e1b2b31 Mon Sep 17 00:00:00 2001 From: philipp Date: Sat, 6 Apr 2024 17:54:07 +0200 Subject: [PATCH 2/2] don't show boats which are still on the water --- src/model/stat.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/model/stat.rs b/src/model/stat.rs index bece501..05d7ea2 100644 --- a/src/model/stat.rs +++ b/src/model/stat.rs @@ -52,6 +52,10 @@ impl BoatStat { let name: String = row.get("name"); let location: String = row.get("location"); let year: i32 = row.get("year"); + if year == 0 { + continue; // Boat still on water + } + if !years.contains(&year) { years.push(year); }