From 87307378c6225fd50b78efe0eb74b1e7a34535ef Mon Sep 17 00:00:00 2001 From: philipp Date: Wed, 24 Apr 2024 17:15:53 +0200 Subject: [PATCH] no special treatment for 'externes boot' --- src/model/boat.rs | 2 +- src/model/logbook.rs | 4 ++-- src/model/stat.rs | 4 ++-- src/tera/board/boathouse.rs | 2 +- templates/includes/forms/log.html.tera | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/model/boat.rs b/src/model/boat.rs index 015a54c..cb13121 100644 --- a/src/model/boat.rs +++ b/src/model/boat.rs @@ -27,7 +27,7 @@ pub struct Boat { #[serde(default = "bool::default")] skull: bool, #[serde(default = "bool::default")] - external: bool, + pub external: bool, pub deleted: bool, } diff --git a/src/model/logbook.rs b/src/model/logbook.rs index 156ad8e..388393f 100644 --- a/src/model/logbook.rs +++ b/src/model/logbook.rs @@ -582,13 +582,13 @@ ORDER BY departure DESC ).await; } - if boat.name == "Externes Boot" { + if boat.external { let vorstand = Role::find_by_name_tx(db, "Vorstand").await.unwrap(); Notification::create_for_role_tx( db, &vorstand, - &format!("'{}' hat eine Ausfahrt mit *Externem Boot* am {} eingetragen ({} km; Ziel: {}; Anmerkungen: {}). Falls das nicht stimmen sollte, bitte nachhaken.",user.name,log.departure,log.distance_in_km, log.destination, log.comments.unwrap_or("".into())), + &format!("'{}' hat eine Ausfahrt mit externem Boot '{}' am {} eingetragen ({} km; Ziel: {}; Anmerkungen: {}). Falls das nicht stimmen sollte, bitte nachhaken.",user.name,boat.name,log.departure,log.distance_in_km, log.destination, log.comments.unwrap_or("".into())), "Ausfahrt mit externem Boot eingetragen", None, ).await; diff --git a/src/model/stat.rs b/src/model/stat.rs index e738a3e..0398115 100644 --- a/src/model/stat.rs +++ b/src/model/stat.rs @@ -40,7 +40,7 @@ LEFT JOIN LEFT JOIN location ON boat.location_id = location.id WHERE - boat.name != 'Externes Boot' AND not boat.external + not boat.external GROUP BY boat.id, year ORDER BY @@ -115,7 +115,7 @@ LEFT JOIN ( FROM rower GROUP BY logbook_id ) m ON l.id = m.logbook_id -WHERE l.distance_in_km IS NOT NULL AND l.arrival LIKE '{year}-%' AND b.name != 'Externes Boot'; +WHERE l.distance_in_km IS NOT NULL AND l.arrival LIKE '{year}-%' AND not b.external; " )) .fetch_one(db) diff --git a/src/tera/board/boathouse.rs b/src/tera/board/boathouse.rs index fbaa16c..54fd729 100644 --- a/src/tera/board/boathouse.rs +++ b/src/tera/board/boathouse.rs @@ -27,7 +27,7 @@ async fn index( let boats = Boat::all_for_boatshouse(db).await; let mut final_boats = Vec::new(); for boat in boats { - if boat.boat.boathouse(db).await.is_none() && boat.boat.name != "Externes Boot" { + if boat.boat.boathouse(db).await.is_none() && !boat.boat.external { final_boats.push(boat); } } diff --git a/templates/includes/forms/log.html.tera b/templates/includes/forms/log.html.tera index 59a2c4f..da17d5c 100644 --- a/templates/includes/forms/log.html.tera +++ b/templates/includes/forms/log.html.tera @@ -228,9 +228,9 @@ {{ rower.name }} {%- if rower.id == log.steering_user.id and rower.id != log.shipmaster_user.id %} (Steuerperson){%- endif -%} - {%- if not loop.last or amount_guests > 0 and log.boat.name != 'Externes Boot' %},{% endif %} + {%- if not loop.last or amount_guests > 0 and not log.boat.external %},{% endif %} {% endfor -%} - {% if amount_guests > 0 and log.boat.name != 'Externes Boot' %} + {% if amount_guests > 0 and not log.boat.external %} Gäste (ohne Account): {{ amount_guests }}