delete cancelled trips if all rowers have seen the notification
All checks were successful
CI/CD Pipeline / test (push) Successful in 11m21s
CI/CD Pipeline / deploy-staging (push) Has been skipped
CI/CD Pipeline / deploy-main (push) Has been skipped

This commit is contained in:
2024-09-03 17:39:08 +03:00
parent 76022a1f0e
commit a441d99b5e
4 changed files with 145 additions and 31 deletions

View File

@ -215,12 +215,18 @@ WHERE day=?
let tripdetails = TripDetails::find_by_id(db, trip_details_id).await.unwrap();
let was_already_cancelled = tripdetails.max_people == 0;
let is_locked = if update.max_people == 0 {
false
} else {
update.is_locked
};
sqlx::query!(
"UPDATE trip_details SET max_people = ?, notes = ?, trip_type_id = ?, is_locked = ? WHERE id = ?",
update.max_people,
update.notes,
update.trip_type,
update.is_locked,
is_locked,
trip_details_id
)
.execute(db)
@ -242,7 +248,7 @@ WHERE day=?
db,
&user,
&format!(
"Die Ausfahrt von {} am {} um {} wurde abgesagt. {}",
"Die Ausfahrt von {} am {} um {} wurde abgesagt. {} Bitte gib Bescheid, dass du die Info erhalten hast indem du auf ✓ klickst.",
update.cox.user.name,
update.trip.day,
update.trip.planned_starting_time,