This commit is contained in:
2023-05-03 13:32:23 +02:00
parent 7981751f18
commit 913d0ac78e
7 changed files with 40 additions and 33 deletions

View File

@ -67,19 +67,7 @@ WHERE trip.id=?
cox: &CoxUser,
planned_event: &PlannedEvent,
) -> Result<(), CoxHelpError> {
let is_rower = sqlx::query!(
"SELECT count(*) as amount
FROM user_trip
WHERE trip_details_id =
(SELECT trip_details_id FROM planned_event WHERE id = ?)
AND user_id = ?",
planned_event.id,
cox.id
)
.fetch_one(db)
.await
.unwrap(); //Okay, bc planned_event can only be created with proper DB backing
if is_rower.amount > 0 {
if planned_event.is_rower_registered(db, &cox).await {
return Err(CoxHelpError::AlreadyRegisteredAsRower);
}
@ -112,6 +100,7 @@ WHERE day=?
.fetch_all(db)
.await
.unwrap(); //TODO: fixme
let mut ret = Vec::new();
for trip in trips {
let mut trip_type = None;