Compare commits

...

5 Commits

Author SHA1 Message Date
6c0f0e6b04 Merge pull request 'better-text' (#562) from better-text into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 9m57s
CI/CD Pipeline / deploy-staging (push) Successful in 5m38s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #562
2024-05-30 11:12:03 +02:00
1bd643f6f4 try
Some checks failed
CI/CD Pipeline / deploy-staging (push) Has been cancelled
CI/CD Pipeline / test (push) Has been cancelled
CI/CD Pipeline / deploy-main (push) Has been cancelled
2024-05-30 11:11:08 +02:00
562c32939d better phrasing of text
All checks were successful
CI/CD Pipeline / test (push) Successful in 9m38s
CI/CD Pipeline / deploy-staging (push) Has been skipped
CI/CD Pipeline / deploy-main (push) Has been skipped
2024-05-30 10:39:55 +02:00
3c0b8e5114 Merge pull request 'fix error' (#560) from fix-user-find-bug into main
All checks were successful
CI/CD Pipeline / test (push) Successful in 9m28s
CI/CD Pipeline / deploy-staging (push) Has been skipped
CI/CD Pipeline / deploy-main (push) Successful in 6m56s
Reviewed-on: #560
2024-05-28 15:04:50 +02:00
a8c0282918 Merge pull request 'migrated db' (#558) from migrated-db into main
All checks were successful
CI/CD Pipeline / test (push) Successful in 9m28s
CI/CD Pipeline / deploy-staging (push) Has been skipped
CI/CD Pipeline / deploy-main (push) Successful in 6m56s
Reviewed-on: #558
2024-05-28 11:27:46 +02:00
2 changed files with 15 additions and 4 deletions

View File

@ -282,16 +282,17 @@ 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() => n, format!("Grund der Absage: {notes}")
_ => ".", } else {
String::from("")
}; };
Notification::create( Notification::create(
db, db,
&user, &user,
&format!( &format!(
"Die Ausfahrt {} am {} um {} wurde abgesagt{}", "Die Ausfahrt {} am {} um {} wurde abgesagt. {}",
self.name, self.day, self.planned_starting_time, notes self.name, self.day, self.planned_starting_time, notes
), ),
"Absage Ausfahrt", "Absage Ausfahrt",

View File

@ -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,