Compare commits

..

3 Commits

Author SHA1 Message Date
a1c7e4c690 Merge pull request 'remove-notification' (#520) from remove-notification into staging
Some checks failed
CI/CD Pipeline / test (push) Successful in 9m25s
CI/CD Pipeline / deploy-staging (push) Has been cancelled
CI/CD Pipeline / deploy-main (push) Has been cancelled
Reviewed-on: #520
2024-05-21 22:17:56 +02:00
64f3596132 remove notificatoin about canceled trip if cancelation has been canceled
All checks were successful
CI/CD Pipeline / test (push) Successful in 9m35s
CI/CD Pipeline / deploy-staging (push) Has been skipped
CI/CD Pipeline / deploy-main (push) Has been skipped
2024-05-21 20:43:05 +02:00
3b75f38dca Merge pull request 'remove users from trip after they have read the notificatoin' (#518) from remove-users-from-canceled-trips-after-reading-notification into main
All checks were successful
CI/CD Pipeline / test (push) Successful in 9m49s
CI/CD Pipeline / deploy-staging (push) Has been skipped
CI/CD Pipeline / deploy-main (push) Successful in 8m30s
Reviewed-on: #518
2024-05-21 20:01:25 +02:00
3 changed files with 22 additions and 0 deletions

View File

@ -154,4 +154,14 @@ ORDER BY read_at DESC, created_at DESC;
}
}
}
pub(crate) async fn delete_by_action(db: &sqlx::Pool<Sqlite>, action: &str) {
sqlx::query!(
"DELETE FROM notification WHERE action_after_reading=? and read_at = null",
action
)
.execute(db)
.await
.unwrap();
}
}

View File

@ -232,6 +232,12 @@ WHERE day=?
.await;
}
}
} else {
Notification::delete_by_action(
db,
&format!("remove_user_trip_with_trip_details_id:{}", trip_details_id),
)
.await;
}
let trip_details = TripDetails::find_by_id(db, trip_details_id).await.unwrap();

View File

@ -77,6 +77,12 @@ WHERE day = ? AND planned_starting_time = ?
return;
}
if self.max_people == 0 {
// Cox cancelled event, thus it's probably bad weather. Don't bother with sending
// notifications
return;
}
if Trip::find_by_trip_details(db, self.id).await.is_none() {
// This trip_details belongs to a planned_event, no need to do anything
return;