Compare commits
5 Commits
e004d81ca1
...
6c0f0e6b04
Author | SHA1 | Date | |
---|---|---|---|
6c0f0e6b04 | |||
1bd643f6f4 | |||
562c32939d | |||
3c0b8e5114 | |||
a8c0282918 |
@ -282,16 +282,17 @@ WHERE trip_details.id=?
|
||||
let rower = Registration::all_rower(db, self.trip_details_id).await;
|
||||
for user in rower {
|
||||
if let Some(user) = User::find_by_name(db, &user.name).await {
|
||||
let notes = match update.notes {
|
||||
Some(n) if !n.is_empty() => n,
|
||||
_ => ".",
|
||||
let notes = if let Some(notes) = update.notes {
|
||||
format!("Grund der Absage: {notes}")
|
||||
} else {
|
||||
String::from("")
|
||||
};
|
||||
|
||||
Notification::create(
|
||||
db,
|
||||
&user,
|
||||
&format!(
|
||||
"Die Ausfahrt {} am {} um {} wurde abgesagt{}",
|
||||
"Die Ausfahrt {} am {} um {} wurde abgesagt. {}",
|
||||
self.name, self.day, self.planned_starting_time, notes
|
||||
),
|
||||
"Absage Ausfahrt",
|
||||
|
@ -135,12 +135,22 @@ ORDER BY read_at DESC, created_at DESC;
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
println!("in mark_read");
|
||||
|
||||
if let Some(action) = self.action_after_reading.as_ref() {
|
||||
println!("{action:#?}");
|
||||
// User read notification about cancelled trip/event
|
||||
let re = Regex::new(r"^remove_user_trip_with_trip_details_id:(\d+)$").unwrap();
|
||||
if let Some(caps) = re.captures(action) {
|
||||
println!("in 2nd if");
|
||||
if let Some(matched) = caps.get(1) {
|
||||
println!("in 3rd if");
|
||||
if let Ok(number) = matched.as_str().parse::<i32>() {
|
||||
println!("number: {number}");
|
||||
println!(
|
||||
"DELETE FROM user_trip WHERE user_id = {} AND trip_details_id = {}",
|
||||
self.user_id, number
|
||||
);
|
||||
let _ = sqlx::query!(
|
||||
"DELETE FROM user_trip WHERE user_id = ? AND trip_details_id = ?",
|
||||
self.user_id,
|
||||
|
Loading…
Reference in New Issue
Block a user