fix-ci-db #438
@ -21,9 +21,9 @@ pub struct Boat {
|
|||||||
pub boatbuilder: Option<String>,
|
pub boatbuilder: Option<String>,
|
||||||
pub default_destination: Option<String>,
|
pub default_destination: Option<String>,
|
||||||
#[serde(default = "bool::default")]
|
#[serde(default = "bool::default")]
|
||||||
convert_handoperated_possible: bool,
|
pub convert_handoperated_possible: bool,
|
||||||
#[serde(default = "bool::default")]
|
#[serde(default = "bool::default")]
|
||||||
default_shipmaster_only_steering: bool,
|
pub default_shipmaster_only_steering: bool,
|
||||||
#[serde(default = "bool::default")]
|
#[serde(default = "bool::default")]
|
||||||
skull: bool,
|
skull: bool,
|
||||||
#[serde(default = "bool::default")]
|
#[serde(default = "bool::default")]
|
||||||
|
@ -126,6 +126,7 @@ pub enum LogbookCreateError {
|
|||||||
NotYourEntry,
|
NotYourEntry,
|
||||||
ArrivalSetButNotRemainingTwo,
|
ArrivalSetButNotRemainingTwo,
|
||||||
OnlyAllowedToEndTripsEndingToday,
|
OnlyAllowedToEndTripsEndingToday,
|
||||||
|
CantChangeHandoperatableStatusForThisBoat,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<LogbookUpdateError> for LogbookCreateError {
|
impl From<LogbookUpdateError> for LogbookCreateError {
|
||||||
@ -302,6 +303,12 @@ ORDER BY departure DESC
|
|||||||
return Err(LogbookCreateError::BoatNotFound);
|
return Err(LogbookCreateError::BoatNotFound);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if log.shipmaster_only_steering != boat.default_shipmaster_only_steering {
|
||||||
|
if !boat.convert_handoperated_possible {
|
||||||
|
return Err(LogbookCreateError::CantChangeHandoperatableStatusForThisBoat);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if boat.amount_seats == 1 && log.rowers.is_empty() {
|
if boat.amount_seats == 1 && log.rowers.is_empty() {
|
||||||
log.rowers = vec![created_by_user.id];
|
log.rowers = vec![created_by_user.id];
|
||||||
}
|
}
|
||||||
|
@ -214,6 +214,7 @@ async fn create_logbook(
|
|||||||
Err(LogbookCreateError::NotYourEntry) => Flash::error(Redirect::to("/log"), "Nicht deine Ausfahrt!"),
|
Err(LogbookCreateError::NotYourEntry) => Flash::error(Redirect::to("/log"), "Nicht deine Ausfahrt!"),
|
||||||
Err(LogbookCreateError::ArrivalSetButNotRemainingTwo) => Flash::error(Redirect::to("/log"), "Ankunftszeit gesetzt aber nicht Distanz + Strecke"),
|
Err(LogbookCreateError::ArrivalSetButNotRemainingTwo) => Flash::error(Redirect::to("/log"), "Ankunftszeit gesetzt aber nicht Distanz + Strecke"),
|
||||||
Err(LogbookCreateError::OnlyAllowedToEndTripsEndingToday) => Flash::error(Redirect::to("/log"), "Nur Ausfahrten, die in der letzten Woche enden dürfen eingetragen werden. Für einen Nachtrag schreibe alle Daten Philipp (Tel. nr. siehe Signal oder it@rudernlinz.at)."),
|
Err(LogbookCreateError::OnlyAllowedToEndTripsEndingToday) => Flash::error(Redirect::to("/log"), "Nur Ausfahrten, die in der letzten Woche enden dürfen eingetragen werden. Für einen Nachtrag schreibe alle Daten Philipp (Tel. nr. siehe Signal oder it@rudernlinz.at)."),
|
||||||
|
Err(LogbookCreateError::CantChangeHandoperatableStatusForThisBoat) => Flash::error(Redirect::to("/log"), "Handsteuer-Status dieses Boots kann nicht verändert werden."),
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user