don't allow to join as user if already cox

This commit is contained in:
2023-04-05 22:01:50 +02:00
parent 9ab1572b15
commit 8f05d1bdf4
3 changed files with 55 additions and 14 deletions

View File

@ -56,7 +56,7 @@ WHERE day=?",
ret
}
pub async fn rower_can_register(db: &SqlitePool, trip_details_id: i64) -> bool {
pub async fn is_full(db: &SqlitePool, trip_details_id: i64) -> bool {
let amount_currently_registered = sqlx::query!(
"SELECT COUNT(*) as count FROM user_trip WHERE trip_details_id = ?",
trip_details_id
@ -75,7 +75,7 @@ WHERE day=?",
.unwrap(); //TODO: fixme
let amount_allowed_to_register = amount_allowed_to_register.max_people;
amount_currently_registered < amount_allowed_to_register
amount_currently_registered >= amount_allowed_to_register
}
async fn get_all_cox_for_id(db: &SqlitePool, id: i64) -> Vec<Registration> {