Compare commits

..

No commits in common. "571e80085f6d5524322eb355f3849cad7e615d07" and "b73ae788e61cbeb6f84c8888ee400540eba9e8dc" have entirely different histories.

4 changed files with 5 additions and 20 deletions

View File

@ -4,7 +4,6 @@ use rocket::serde::{Deserialize, Serialize};
use rocket::FromForm;
use sqlx::{FromRow, Sqlite, SqlitePool, Transaction};
use super::location::Location;
use super::user::User;
#[derive(FromRow, Debug, Serialize, Deserialize)]
@ -95,15 +94,6 @@ impl Boat {
return owner_id == user.id;
}
if user.has_role(db, "Rennrudern").await {
let ottensheim = Location::find_by_name(db, "Ottensheim".into())
.await
.unwrap();
if self.location_id == ottensheim.id {
return true;
}
}
if self.amount_seats == 1 {
return true;
}

View File

@ -471,12 +471,7 @@ ORDER BY departure DESC
return Err(LogbookUpdateError::ArrivalNotAfterDeparture);
}
let today = Utc::now().date_naive();
let day_diff = today - arr.date();
let day_diff = day_diff.num_days();
if day_diff >= 7 && !user.has_role_tx(db, "admin").await {
return Err(LogbookUpdateError::OnlyAllowedToEndTripsEndingToday);
}
if day_diff < 0 && !user.has_role_tx(db, "admin").await {
if arr.date() != today && !user.has_role_tx(db, "admin").await {
return Err(LogbookUpdateError::OnlyAllowedToEndTripsEndingToday);
}

View File

@ -127,7 +127,7 @@ async fn kiosk(
flash: Option<FlashMessage<'_>>,
kiosk: KioskCookie,
) -> Template {
let boats = Boat::all(db).await;
let boats = Boat::all_at_location(db, kiosk.0).await;
let coxes: Vec<UserWithWaterStatus> = futures::future::join_all(
User::cox(db)
.await
@ -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::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::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 heute enden dürfen eingetragen werden. Für einen Nachtrag schreibe alle Daten Philipp (Tel. nr. siehe Signal oder it@rudernlinz.at)."),
}
}

View File

@ -199,9 +199,9 @@
<div class="text-sm text-gray-600 dark:text-gray-100">
Ruderer:
{% for rower in log.rowers %}
{{ rower.name }}{% if not loop.last or amount_guests > 0 and log.boat.name != 'Externes Boot' %}, {% endif %}
{{ rower.name }}{% if not loop.last or amount_guests > 0 %}, {% endif %}
{% endfor %}
{% if amount_guests > 0 and log.boat.name != 'Externes Boot' %}
{% if amount_guests > 0 %}
Gäste <small class="text-gray-600 dark:text-gray-100">(ohne Account)</small>: {{ amount_guests }}
{% endif %}
</div>