calc general boat cat (#436)
All checks were successful
CI/CD Pipeline / test (push) Successful in 8m1s
CI/CD Pipeline / deploy-staging (push) Has been skipped
CI/CD Pipeline / deploy-main (push) Successful in 5m19s

Reviewed-on: #436
This commit is contained in:
2024-04-24 15:39:13 +02:00
parent aac7444896
commit 43e073c54e
5 changed files with 29 additions and 15 deletions

View File

@ -126,6 +126,7 @@ pub enum LogbookCreateError {
NotYourEntry,
ArrivalSetButNotRemainingTwo,
OnlyAllowedToEndTripsEndingToday,
CantChangeHandoperatableStatusForThisBoat,
}
impl From<LogbookUpdateError> for LogbookCreateError {
@ -302,6 +303,12 @@ ORDER BY departure DESC
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() {
log.rowers = vec![created_by_user.id];
}