more rights to the kiosk!
This commit is contained in:
parent
7a622a5615
commit
2eba6a0f66
@ -210,10 +210,19 @@ async fn create_kiosk(
|
|||||||
data: Form<LogToAdd>,
|
data: Form<LogToAdd>,
|
||||||
_kiosk: KioskCookie,
|
_kiosk: KioskCookie,
|
||||||
) -> Flash<Redirect> {
|
) -> Flash<Redirect> {
|
||||||
let creator = if let Some(shipmaster) = data.shipmaster {
|
let Some(boat) = Boat::find_by_id(db, data.boat_id).await else {
|
||||||
|
return Flash::error(Redirect::to("/log"), "Boot gibt's nicht");
|
||||||
|
};
|
||||||
|
let creator = if boat.amount_seats == 1 && boat.owner.is_some() {
|
||||||
|
User::find_by_id(db, boat.owner.unwrap() as i32)
|
||||||
|
.await
|
||||||
|
.unwrap()
|
||||||
|
} else {
|
||||||
|
if let Some(shipmaster) = data.shipmaster {
|
||||||
User::find_by_id(db, shipmaster as i32).await.unwrap()
|
User::find_by_id(db, shipmaster as i32).await.unwrap()
|
||||||
} else {
|
} else {
|
||||||
User::find_by_id(db, data.rowers[0] as i32).await.unwrap()
|
User::find_by_id(db, data.rowers[0] as i32).await.unwrap()
|
||||||
|
}
|
||||||
};
|
};
|
||||||
Log::create(
|
Log::create(
|
||||||
db,
|
db,
|
||||||
|
Loading…
Reference in New Issue
Block a user