add cox_needed attribute
This commit is contained in:
@ -19,6 +19,7 @@ pub struct PlannedEvent {
|
||||
pub struct PlannedEventWithUser {
|
||||
#[serde(flatten)]
|
||||
planned_event: PlannedEvent,
|
||||
cox_needed: bool,
|
||||
cox: Vec<Registration>,
|
||||
rower: Vec<Registration>,
|
||||
}
|
||||
@ -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,
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user