styling-mail #388
@ -507,7 +507,7 @@ ORDER BY departure DESC
|
|||||||
|
|
||||||
let dep = NaiveDateTime::parse_from_str(&log.departure, "%Y-%m-%dT%H:%M").unwrap();
|
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();
|
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);
|
return Err(LogbookUpdateError::ArrivalNotAfterDeparture);
|
||||||
}
|
}
|
||||||
let today = Local::now().date_naive();
|
let today = Local::now().date_naive();
|
||||||
|
@ -78,7 +78,7 @@ impl Trip {
|
|||||||
"{} hat eine Ausfahrt zur selben Zeit ({} um {}) wie du erstellt",
|
"{} hat eine Ausfahrt zur selben Zeit ({} um {}) wie du erstellt",
|
||||||
cox.user.name, trip.day, trip.planned_starting_time
|
cox.user.name, trip.day, trip.planned_starting_time
|
||||||
),
|
),
|
||||||
"Neue Ausfahrt zur selben Zeit".into(),
|
"Neue Ausfahrt zur selben Zeit",
|
||||||
None,
|
None,
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
|
@ -27,8 +27,7 @@ impl UserTrip {
|
|||||||
//TODO: Check if user sees the event (otherwise she could forge trip_details_id)
|
//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 is_cox = trip_details.user_is_cox(db, user).await;
|
||||||
let mut name_newly_registered_person = String::new();
|
let name_newly_registered_person = if user_note.is_none() {
|
||||||
if user_note.is_none() {
|
|
||||||
if let Yes(action) = is_cox {
|
if let Yes(action) = is_cox {
|
||||||
match action {
|
match action {
|
||||||
Action::Helping => return Err(UserTripError::AlreadyRegisteredAsCox),
|
Action::Helping => return Err(UserTripError::AlreadyRegisteredAsCox),
|
||||||
@ -49,7 +48,7 @@ impl UserTrip {
|
|||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
name_newly_registered_person = user.name.clone();
|
user.name.clone()
|
||||||
} else {
|
} else {
|
||||||
if !trip_details.user_allowed_to_change(db, user).await {
|
if !trip_details.user_allowed_to_change(db, user).await {
|
||||||
return Err(UserTripError::NotAllowedToAddGuest);
|
return Err(UserTripError::NotAllowedToAddGuest);
|
||||||
@ -63,8 +62,8 @@ impl UserTrip {
|
|||||||
.await
|
.await
|
||||||
.unwrap();
|
.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 {
|
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();
|
let cox = User::find_by_id(db, trip.cox_id as i32).await.unwrap();
|
||||||
|
@ -26,7 +26,7 @@ async fn index(
|
|||||||
}
|
}
|
||||||
context.insert(
|
context.insert(
|
||||||
"loggedin_user",
|
"loggedin_user",
|
||||||
&UserWithRoles::from_user(user.user.into(), db).await,
|
&UserWithRoles::from_user(user.user, db).await,
|
||||||
);
|
);
|
||||||
context.insert("roles", &Role::all(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");
|
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;
|
Notification::create(db, &user, &d.message, &d.category, None).await;
|
||||||
}
|
}
|
||||||
Log::create(db, "Notification successfully sent".into()).await;
|
Log::create(db, "Notification successfully sent".into()).await;
|
||||||
|
@ -27,10 +27,8 @@ async fn index(
|
|||||||
let boats = Boat::all_for_boatshouse(db).await;
|
let boats = Boat::all_for_boatshouse(db).await;
|
||||||
let mut final_boats = Vec::new();
|
let mut final_boats = Vec::new();
|
||||||
for boat in boats {
|
for boat in boats {
|
||||||
if boat.boat.boathouse(db).await.is_none() {
|
if boat.boat.boathouse(db).await.is_none() && boat.boat.name != "Externes Boot" {
|
||||||
if boat.boat.name != "Externes Boot" {
|
final_boats.push(boat);
|
||||||
final_boats.push(boat);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ async fn delete<'r>(
|
|||||||
} else {
|
} else {
|
||||||
Flash::error(
|
Flash::error(
|
||||||
Redirect::to("/boatreservation"),
|
Redirect::to("/boatreservation"),
|
||||||
format!("Nur der Reservierer darf die Reservierung löschen."),
|
"Nur der Reservierer darf die Reservierung löschen.".to_string(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -66,8 +66,8 @@ async fn steering(db: &State<SqlitePool>, user: User, flash: Option<FlashMessage
|
|||||||
|
|
||||||
let mut coxes = User::all_with_role(db, &Role::find_by_name(db, "cox").await.unwrap()).await;
|
let mut coxes = User::all_with_role(db, &Role::find_by_name(db, "cox").await.unwrap()).await;
|
||||||
|
|
||||||
coxes.retain(|user| !bootskundige.contains(&user)); // Remove bootskundige from coxes list
|
coxes.retain(|user| !bootskundige.contains(user)); // Remove bootskundige from coxes list
|
||||||
coxes.retain(|user| user.name != String::from("Externe Steuerperson"));
|
coxes.retain(|user| user.name != "Externe Steuerperson");
|
||||||
|
|
||||||
context.insert("coxes", &coxes);
|
context.insert("coxes", &coxes);
|
||||||
context.insert("bootskundige", &bootskundige);
|
context.insert("bootskundige", &bootskundige);
|
||||||
|
Loading…
Reference in New Issue
Block a user