add cox_needed attribute

This commit is contained in:
philipp 2023-04-06 20:08:58 +02:00
parent 12672917bb
commit 4d49574ebb
2 changed files with 9 additions and 1 deletions

View File

@ -19,6 +19,7 @@ pub struct PlannedEvent {
pub struct PlannedEventWithUser { pub struct PlannedEventWithUser {
#[serde(flatten)] #[serde(flatten)]
planned_event: PlannedEvent, planned_event: PlannedEvent,
cox_needed: bool,
cox: Vec<Registration>, cox: Vec<Registration>,
rower: Vec<Registration>, rower: Vec<Registration>,
} }
@ -47,9 +48,11 @@ WHERE day=?",
let mut ret = Vec::new(); let mut ret = Vec::new();
for event in events { for event in events {
let cox = Self::get_all_cox_for_id(db, event.id).await;
ret.push(PlannedEventWithUser { ret.push(PlannedEventWithUser {
planned_event: event.clone(), 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, rower: Self::get_all_rower_for_id(db, event.id).await,
}); });
} }

View File

@ -30,6 +30,11 @@
<div class="pt-2"> <div class="pt-2">
<div class="flex justify-between items-center"> <div class="flex justify-between items-center">
<div> <div>
{% if planned_event.cox_needed %}
zusätzliche steuerperson notwendig!!!!!!elf!!
{% else %}
keine zusätzliche unbedingt notwendig
{% endif %}
<strong class="text-primary-900">{{ planned_event.planned_starting_time }} Uhr</strong> <small class="text-gray-600">({{ planned_event.name }})</small><br/> <strong class="text-primary-900">{{ planned_event.planned_starting_time }} Uhr</strong> <small class="text-gray-600">({{ planned_event.name }})</small><br/>
<a href="#" data-sidebar="true" data-trigger="detailEvent{{ planned_event.id }}" class="inline-block text-primary-600 hover:text-primary-900 underline mr-3">Details</a> <a href="#" data-sidebar="true" data-trigger="detailEvent{{ planned_event.id }}" class="inline-block text-primary-600 hover:text-primary-900 underline mr-3">Details</a>
</div> </div>