Compare commits
No commits in common. "127d9784ad94aa54c442f228f1653daa8ab2969b" and "26aa222bc604064ba8a239263d8a1fe73039ff2f" have entirely different histories.
127d9784ad
...
26aa222bc6
@ -127,7 +127,6 @@ pub enum LogbookUpdateError {
|
||||
OnlyAllowedToEndTripsEndingToday,
|
||||
TooFast(i64, i64),
|
||||
AlreadyFinalized,
|
||||
ExternalSteeringPersonMustSteer,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
@ -153,7 +152,6 @@ pub enum LogbookCreateError {
|
||||
CantChangeHandoperatableStatusForThisBoat,
|
||||
TooFast(i64, i64),
|
||||
AlreadyFinalized,
|
||||
ExternalSteeringPersonMustSteer,
|
||||
}
|
||||
|
||||
impl From<LogbookUpdateError> for LogbookCreateError {
|
||||
@ -179,9 +177,6 @@ impl From<LogbookUpdateError> for LogbookCreateError {
|
||||
}
|
||||
LogbookUpdateError::TooFast(km, min) => LogbookCreateError::TooFast(km, min),
|
||||
LogbookUpdateError::AlreadyFinalized => LogbookCreateError::AlreadyFinalized,
|
||||
LogbookUpdateError::ExternalSteeringPersonMustSteer => {
|
||||
LogbookCreateError::ExternalSteeringPersonMustSteer
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -419,14 +414,6 @@ ORDER BY departure DESC
|
||||
if user.on_water(db).await {
|
||||
return Err(LogbookCreateError::RowerAlreadyOnWater(Box::new(user)));
|
||||
}
|
||||
|
||||
if user.name == "Externe Steuerperson" {
|
||||
if let Some(steering_id) = log.steering_person {
|
||||
if steering_id != user.id {
|
||||
return Err(LogbookCreateError::ExternalSteeringPersonMustSteer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if !boat.shipmaster_allowed(db, created_by_user).await {
|
||||
@ -622,13 +609,6 @@ ORDER BY departure DESC
|
||||
|
||||
self.remove_rowers(db).await;
|
||||
for rower in &log.rowers {
|
||||
if user.name == "Externe Steuerperson" {
|
||||
if let Some(steering_id) = log.steering_person {
|
||||
if steering_id != user.id {
|
||||
return Err(LogbookUpdateError::ExternalSteeringPersonMustSteer);
|
||||
}
|
||||
}
|
||||
}
|
||||
Rower::create(db, self.id, *rower)
|
||||
.await
|
||||
.map_err(|e| LogbookUpdateError::RowerCreateError(*rower, e.to_string()))?;
|
||||
|
@ -68,9 +68,7 @@ async fn index(
|
||||
)
|
||||
.await;
|
||||
users.retain(|u| {
|
||||
u.roles.contains(&"Donau Linz".into())
|
||||
|| u.roles.contains(&"scheckbuch".into())
|
||||
|| u.user.name == "Externe Steuerperson"
|
||||
u.roles.contains(&"Donau Linz".into()) || u.roles.contains(&"scheckbuch".into())
|
||||
});
|
||||
|
||||
let logtypes = LogType::all(db).await;
|
||||
@ -231,7 +229,6 @@ async fn create_logbook(
|
||||
Err(LogbookCreateError::CantChangeHandoperatableStatusForThisBoat) => Flash::error(Redirect::to("/log"), "Handsteuer-Status dieses Boots kann nicht verändert werden."),
|
||||
Err(LogbookCreateError::TooFast(km, min)) => Flash::error(Redirect::to("/log"), format!("KM zu groß für die eingegebene Dauer ({km} km in {min} Minuten). Bitte überprüfe deine Start- und Endzeit und versuche es erneut.")),
|
||||
Err(LogbookCreateError::AlreadyFinalized) => Flash::error(Redirect::to("/log"), "Logbucheintrag wurde bereits abgeschlossen."),
|
||||
Err(LogbookCreateError::ExternalSteeringPersonMustSteer) => Flash::error(Redirect::to("/log"), "Wenn du eine 'Externe Steuerperson' hinzufügst, muss diese steuern!"),
|
||||
}
|
||||
}
|
||||
|
||||
@ -341,7 +338,6 @@ async fn home_logbook(
|
||||
Err(LogbookUpdateError::OnlyAllowedToEndTripsEndingToday) => Flash::error(Redirect::to("/log"), "Nur Ausfahrten, die heute enden dürfen eingetragen werden. Für einen Nachtrag schreibe alle Daten Philipp (Tel. nr. siehe Signal oder it@rudernlinz.at)."),
|
||||
Err(LogbookUpdateError::TooFast(km, min)) => Flash::error(Redirect::to("/log"), format!("KM zu groß für die eingegebene Dauer ({km} km in {min} Minuten). Bitte überprüfe deine Start- und Endzeit und versuche es erneut.")),
|
||||
Err(LogbookUpdateError::AlreadyFinalized) => Flash::error(Redirect::to("/log"), "Logbucheintrag wurde bereits abgeschlossen."),
|
||||
Err(LogbookUpdateError::ExternalSteeringPersonMustSteer) => Flash::error(Redirect::to("/log"), "Wenn du eine 'Externe Steuerperson' hinzufügst, muss diese steuern!"),
|
||||
Err(e) => Flash::error(
|
||||
Redirect::to("/log"),
|
||||
format!("Eintrag {logbook_id} konnte nicht abgesendet werden (Fehler: {e:?})!"),
|
||||
|
Loading…
Reference in New Issue
Block a user