better text for boat reservation #349

Merged
philipp merged 1 commits from staging into main 2024-04-07 22:13:35 +02:00
Showing only changes of commit 7cbfafa5c5 - Show all commits

View File

@ -126,15 +126,23 @@ WHERE end_date >= CURRENT_DATE ORDER BY end_date
let board = let board =
User::all_with_role(db, &Role::find_by_name(db, "Vorstand").await.unwrap()).await; User::all_with_role(db, &Role::find_by_name(db, "Vorstand").await.unwrap()).await;
for user in board { for user in board {
let date = if boatreservation.start_date == boatreservation.end_date {
format!("am {}", boatreservation.start_date)
} else {
format!(
"von {} bis {}",
boatreservation.start_date, boatreservation.end_date
)
};
Notification::create( Notification::create(
db, db,
&user, &user,
&format!( &format!(
"{} hat eine neue Bootsreservierung für Boot '{}' angelegt: Von {} bis {} um {} wegen {}", "{} hat eine neue Bootsreservierung für Boot '{}' {} angelegt. Zeit: {}; Zweck: {}",
boatreservation.user_applicant.name, boatreservation.user_applicant.name,
boatreservation.boat.name, boatreservation.boat.name,
boatreservation.start_date, date,
boatreservation.end_date,
boatreservation.time_desc, boatreservation.time_desc,
boatreservation.usage boatreservation.usage
), ),