diff --git a/src/model/logbook.rs b/src/model/logbook.rs index d853b3f..9ccae27 100644 --- a/src/model/logbook.rs +++ b/src/model/logbook.rs @@ -507,7 +507,7 @@ ORDER BY departure DESC let dep = NaiveDateTime::parse_from_str(&log.departure, "%Y-%m-%dT%H:%M").unwrap(); let arr = NaiveDateTime::parse_from_str(&log.arrival, "%Y-%m-%dT%H:%M").unwrap(); - if arr.timestamp() < dep.timestamp() { + if arr.and_utc().timestamp() < dep.and_utc().timestamp() { return Err(LogbookUpdateError::ArrivalNotAfterDeparture); } let today = Local::now().date_naive(); diff --git a/src/model/trip.rs b/src/model/trip.rs index a8d4e16..407dded 100644 --- a/src/model/trip.rs +++ b/src/model/trip.rs @@ -78,7 +78,7 @@ impl Trip { "{} hat eine Ausfahrt zur selben Zeit ({} um {}) wie du erstellt", cox.user.name, trip.day, trip.planned_starting_time ), - "Neue Ausfahrt zur selben Zeit".into(), + "Neue Ausfahrt zur selben Zeit", None, ) .await; diff --git a/src/model/usertrip.rs b/src/model/usertrip.rs index 647f7cd..c37c834 100644 --- a/src/model/usertrip.rs +++ b/src/model/usertrip.rs @@ -27,8 +27,7 @@ impl UserTrip { //TODO: Check if user sees the event (otherwise she could forge trip_details_id) let is_cox = trip_details.user_is_cox(db, user).await; - let mut name_newly_registered_person = String::new(); - if user_note.is_none() { + let name_newly_registered_person = if user_note.is_none() { if let Yes(action) = is_cox { match action { Action::Helping => return Err(UserTripError::AlreadyRegisteredAsCox), @@ -49,7 +48,7 @@ impl UserTrip { .await .unwrap(); - name_newly_registered_person = user.name.clone(); + user.name.clone() } else { if !trip_details.user_allowed_to_change(db, user).await { return Err(UserTripError::NotAllowedToAddGuest); @@ -63,8 +62,8 @@ impl UserTrip { .await .unwrap(); - name_newly_registered_person = user_note.unwrap(); - } + user_note.unwrap() + }; if let Some(trip) = Trip::find_by_trip_details(db, trip_details.id).await { let cox = User::find_by_id(db, trip.cox_id as i32).await.unwrap(); diff --git a/src/tera/admin/notification.rs b/src/tera/admin/notification.rs index e8d6cb3..2e36c51 100644 --- a/src/tera/admin/notification.rs +++ b/src/tera/admin/notification.rs @@ -26,7 +26,7 @@ async fn index( } context.insert( "loggedin_user", - &UserWithRoles::from_user(user.user.into(), db).await, + &UserWithRoles::from_user(user.user, db).await, ); context.insert("roles", &Role::all(db).await); @@ -57,7 +57,7 @@ async fn send( return Flash::error(Redirect::to("/admin/notification"), "Rolle gibt's ned"); }; - for user in User::all_with_role(&db, &role).await { + for user in User::all_with_role(db, &role).await { Notification::create(db, &user, &d.message, &d.category, None).await; } Log::create(db, "Notification successfully sent".into()).await; diff --git a/src/tera/board/boathouse.rs b/src/tera/board/boathouse.rs index e0336fd..266f81a 100644 --- a/src/tera/board/boathouse.rs +++ b/src/tera/board/boathouse.rs @@ -27,10 +27,8 @@ async fn index( let boats = Boat::all_for_boatshouse(db).await; let mut final_boats = Vec::new(); for boat in boats { - if boat.boat.boathouse(db).await.is_none() { - if boat.boat.name != "Externes Boot" { - final_boats.push(boat); - } + if boat.boat.boathouse(db).await.is_none() && boat.boat.name != "Externes Boot" { + final_boats.push(boat); } } diff --git a/src/tera/boatreservation.rs b/src/tera/boatreservation.rs index bbb67ce..0cc5574 100644 --- a/src/tera/boatreservation.rs +++ b/src/tera/boatreservation.rs @@ -161,7 +161,7 @@ async fn delete<'r>( } else { Flash::error( Redirect::to("/boatreservation"), - format!("Nur der Reservierer darf die Reservierung löschen."), + "Nur der Reservierer darf die Reservierung löschen.".to_string(), ) } } diff --git a/src/tera/mod.rs b/src/tera/mod.rs index 1ca1ca1..9836226 100644 --- a/src/tera/mod.rs +++ b/src/tera/mod.rs @@ -66,8 +66,8 @@ async fn steering(db: &State, user: User, flash: Option