show ottensheim boats to rennjugend
This commit is contained in:
parent
cc7ba59407
commit
d1296ec40a
@ -4,6 +4,7 @@ INSERT INTO "role" (name) VALUES ('scheckbuch');
|
|||||||
INSERT INTO "role" (name) VALUES ('tech');
|
INSERT INTO "role" (name) VALUES ('tech');
|
||||||
INSERT INTO "role" (name) VALUES ('Donau Linz');
|
INSERT INTO "role" (name) VALUES ('Donau Linz');
|
||||||
INSERT INTO "role" (name) VALUES ('planned_event');
|
INSERT INTO "role" (name) VALUES ('planned_event');
|
||||||
|
INSERT INTO "role" (name) VALUES ('Rennrudern');
|
||||||
INSERT INTO "user" (name, pw) VALUES('admin', '$argon2id$v=19$m=19456,t=2,p=1$dS/X5/sPEKTj4Rzs/CuvzQ$4P4NCw4Ukhv80/eQYTsarHhnw61JuL1KMx/L9dm82YM');
|
INSERT INTO "user" (name, pw) VALUES('admin', '$argon2id$v=19$m=19456,t=2,p=1$dS/X5/sPEKTj4Rzs/CuvzQ$4P4NCw4Ukhv80/eQYTsarHhnw61JuL1KMx/L9dm82YM');
|
||||||
INSERT INTO "user_role" (user_id, role_id) VALUES(1,1);
|
INSERT INTO "user_role" (user_id, role_id) VALUES(1,1);
|
||||||
INSERT INTO "user_role" (user_id, role_id) VALUES(1,2);
|
INSERT INTO "user_role" (user_id, role_id) VALUES(1,2);
|
||||||
@ -24,6 +25,9 @@ INSERT INTO "user_role" (user_id, role_id) VALUES(6,5);
|
|||||||
INSERT INTO "user_role" (user_id, role_id) VALUES(6,2);
|
INSERT INTO "user_role" (user_id, role_id) VALUES(6,2);
|
||||||
INSERT INTO "user" (name, pw) VALUES('rower2', '$argon2id$v=19$m=19456,t=2,p=1$dS/X5/sPEKTj4Rzs/CuvzQ$jWKzDmI0jqT2dqINFt6/1NjVF4Dx15n07PL1ZMBmFsY');
|
INSERT INTO "user" (name, pw) VALUES('rower2', '$argon2id$v=19$m=19456,t=2,p=1$dS/X5/sPEKTj4Rzs/CuvzQ$jWKzDmI0jqT2dqINFt6/1NjVF4Dx15n07PL1ZMBmFsY');
|
||||||
INSERT INTO "user_role" (user_id, role_id) VALUES(7,5);
|
INSERT INTO "user_role" (user_id, role_id) VALUES(7,5);
|
||||||
|
INSERT INTO "user" (name, pw) VALUES('teen', '$argon2id$v=19$m=19456,t=2,p=1$dS/X5/sPEKTj4Rzs/CuvzQ$jWKzDmI0jqT2dqINFt6/1NjVF4Dx15n07PL1ZMBmFsY');
|
||||||
|
INSERT INTO "user_role" (user_id, role_id) VALUES(8,5);
|
||||||
|
INSERT INTO "user_role" (user_id, role_id) VALUES(8,7);
|
||||||
|
|
||||||
INSERT INTO "trip_details" (planned_starting_time, max_people, day, notes) VALUES('10:00', 2, '1970-01-01', 'trip_details for a planned event');
|
INSERT INTO "trip_details" (planned_starting_time, max_people, day, notes) VALUES('10:00', 2, '1970-01-01', 'trip_details for a planned event');
|
||||||
INSERT INTO "planned_event" (name, planned_amount_cox, trip_details_id) VALUES('test-planned-event', 2, 1);
|
INSERT INTO "planned_event" (name, planned_amount_cox, trip_details_id) VALUES('test-planned-event', 2, 1);
|
||||||
|
@ -185,7 +185,7 @@ ORDER BY amount_seats DESC
|
|||||||
if user.has_role(db, "admin").await {
|
if user.has_role(db, "admin").await {
|
||||||
return Self::all(db).await;
|
return Self::all(db).await;
|
||||||
}
|
}
|
||||||
let boats = if user.has_role(db, "cox").await {
|
let mut boats = if user.has_role(db, "cox").await {
|
||||||
sqlx::query_as!(
|
sqlx::query_as!(
|
||||||
Boat,
|
Boat,
|
||||||
"
|
"
|
||||||
@ -215,6 +215,23 @@ ORDER BY amount_seats DESC
|
|||||||
.unwrap() //TODO: fixme
|
.unwrap() //TODO: fixme
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if user.has_role(db, "Rennrudern").await {
|
||||||
|
let ottensheim = Location::find_by_name(db, "Ottensheim".into())
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
let boats_in_ottensheim = sqlx::query_as!(
|
||||||
|
Boat,
|
||||||
|
"SELECT id, name, amount_seats, location_id, owner, year_built, boatbuilder, default_shipmaster_only_steering, default_destination, skull, external
|
||||||
|
FROM boat
|
||||||
|
WHERE owner is null and location_id = ?
|
||||||
|
ORDER BY amount_seats DESC
|
||||||
|
",ottensheim.id)
|
||||||
|
.fetch_all(db)
|
||||||
|
.await
|
||||||
|
.unwrap(); //TODO: fixme
|
||||||
|
boats.extend(boats_in_ottensheim.into_iter());
|
||||||
|
}
|
||||||
|
|
||||||
Self::boats_to_details(db, boats).await
|
Self::boats_to_details(db, boats).await
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -274,8 +274,6 @@ ORDER BY departure DESC
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let Ok(log_to_finalize) = TryInto::<LogToFinalize>::try_into(log.clone()) {
|
if let Ok(log_to_finalize) = TryInto::<LogToFinalize>::try_into(log.clone()) {
|
||||||
//TODO: fix clone() above
|
|
||||||
|
|
||||||
if !boat.shipmaster_allowed(db, created_by_user).await {
|
if !boat.shipmaster_allowed(db, created_by_user).await {
|
||||||
return Err(LogbookCreateError::UserNotAllowedToUseBoat);
|
return Err(LogbookCreateError::UserNotAllowedToUseBoat);
|
||||||
}
|
}
|
||||||
|
@ -188,7 +188,7 @@ async fn create_logbook(
|
|||||||
Err(LogbookCreateError::ShipmasterNotInRowers) => Flash::error(Redirect::to("/log"), "Schiffsführer nicht in Liste der Ruderer!"),
|
Err(LogbookCreateError::ShipmasterNotInRowers) => Flash::error(Redirect::to("/log"), "Schiffsführer nicht in Liste der Ruderer!"),
|
||||||
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 den 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)."),
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user