From 4d49574ebb9565523acf16853be3d4922f2a6e63 Mon Sep 17 00:00:00 2001 From: philipp Date: Thu, 6 Apr 2023 20:08:58 +0200 Subject: [PATCH] add cox_needed attribute --- src/model/planned_event.rs | 5 ++++- templates/index.html.tera | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/model/planned_event.rs b/src/model/planned_event.rs index c1718c2..f837149 100644 --- a/src/model/planned_event.rs +++ b/src/model/planned_event.rs @@ -19,6 +19,7 @@ pub struct PlannedEvent { pub struct PlannedEventWithUser { #[serde(flatten)] planned_event: PlannedEvent, + cox_needed: bool, cox: Vec, rower: Vec, } @@ -47,9 +48,11 @@ WHERE day=?", let mut ret = Vec::new(); for event in events { + let cox = Self::get_all_cox_for_id(db, event.id).await; ret.push(PlannedEventWithUser { planned_event: event.clone(), - cox: Self::get_all_cox_for_id(db, event.id).await, + cox_needed: event.planned_amount_cox > cox.len() as i64, + cox, rower: Self::get_all_rower_for_id(db, event.id).await, }); } diff --git a/templates/index.html.tera b/templates/index.html.tera index 466028d..20e6ad8 100644 --- a/templates/index.html.tera +++ b/templates/index.html.tera @@ -30,6 +30,11 @@
+ {% if planned_event.cox_needed %} + zusätzliche steuerperson notwendig!!!!!!elf!! + {% else %} + keine zusätzliche unbedingt notwendig + {% endif %} {{ planned_event.planned_starting_time }} Uhr ({{ planned_event.name }})
Details