Compare commits
No commits in common. "7d44204533575e654060ec48220a576025c07ad0" and "145892104b5c4cc91fc766fc6734536af261ada4" have entirely different histories.
7d44204533
...
145892104b
@ -259,9 +259,10 @@ WHERE trip_details.id=?
|
|||||||
let coxes = Registration::all_cox(db, self.id).await;
|
let coxes = Registration::all_cox(db, self.id).await;
|
||||||
for user in coxes {
|
for user in coxes {
|
||||||
if let Some(user) = User::find_by_name(db, &user.name).await {
|
if let Some(user) = User::find_by_name(db, &user.name).await {
|
||||||
let notes = match update.notes {
|
let notes = if let Some(notes) = update.notes {
|
||||||
Some(n) if !n.is_empty() => format!("Grund der Absage: {n}"),
|
format!("Grund der Absage: {notes}")
|
||||||
_ => String::from(""),
|
} else {
|
||||||
|
String::from("")
|
||||||
};
|
};
|
||||||
Notification::create(
|
Notification::create(
|
||||||
db,
|
db,
|
||||||
@ -281,9 +282,10 @@ WHERE trip_details.id=?
|
|||||||
let rower = Registration::all_rower(db, self.trip_details_id).await;
|
let rower = Registration::all_rower(db, self.trip_details_id).await;
|
||||||
for user in rower {
|
for user in rower {
|
||||||
if let Some(user) = User::find_by_name(db, &user.name).await {
|
if let Some(user) = User::find_by_name(db, &user.name).await {
|
||||||
let notes = match update.notes {
|
let notes = if let Some(notes) = update.notes {
|
||||||
Some(n) if !n.is_empty() => format!("Grund der Absage: {n}"),
|
format!("Grund der Absage: {notes}")
|
||||||
_ => String::from(""),
|
} else {
|
||||||
|
String::from("")
|
||||||
};
|
};
|
||||||
|
|
||||||
Notification::create(
|
Notification::create(
|
||||||
|
@ -135,12 +135,22 @@ ORDER BY read_at DESC, created_at DESC;
|
|||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
|
println!("in mark_read");
|
||||||
|
|
||||||
if let Some(action) = self.action_after_reading.as_ref() {
|
if let Some(action) = self.action_after_reading.as_ref() {
|
||||||
|
println!("{action:#?}");
|
||||||
// User read notification about cancelled trip/event
|
// User read notification about cancelled trip/event
|
||||||
let re = Regex::new(r"^remove_user_trip_with_trip_details_id:(\d+)$").unwrap();
|
let re = Regex::new(r"^remove_user_trip_with_trip_details_id:(\d+)$").unwrap();
|
||||||
if let Some(caps) = re.captures(action) {
|
if let Some(caps) = re.captures(action) {
|
||||||
|
println!("in 2nd if");
|
||||||
if let Some(matched) = caps.get(1) {
|
if let Some(matched) = caps.get(1) {
|
||||||
|
println!("in 3rd if");
|
||||||
if let Ok(number) = matched.as_str().parse::<i32>() {
|
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!(
|
let _ = sqlx::query!(
|
||||||
"DELETE FROM user_trip WHERE user_id = ? AND trip_details_id = ?",
|
"DELETE FROM user_trip WHERE user_id = ? AND trip_details_id = ?",
|
||||||
self.user_id,
|
self.user_id,
|
||||||
|
@ -223,9 +223,10 @@ WHERE day=?
|
|||||||
.rower;
|
.rower;
|
||||||
for user in rowers {
|
for user in rowers {
|
||||||
if let Some(user) = User::find_by_name(db, &user.name).await {
|
if let Some(user) = User::find_by_name(db, &user.name).await {
|
||||||
let notes = match update.notes {
|
let notes = if let Some(notes) = update.notes {
|
||||||
Some(n) if !n.is_empty() => format!("Grund der Absage: {n}"),
|
format!("Grund der Absage: {notes}")
|
||||||
_ => String::from(""),
|
} else {
|
||||||
|
String::from("")
|
||||||
};
|
};
|
||||||
|
|
||||||
Notification::create(
|
Notification::create(
|
||||||
|
Loading…
Reference in New Issue
Block a user