Merge branch 'main' of gitlab.com:PhilippHofer/rot

This commit is contained in:
Philipp 2023-07-24 13:01:52 +02:00
commit a4c4d917a8
10 changed files with 380 additions and 66 deletions

View File

@ -4,7 +4,10 @@
## New large features ## New large features
### Logbuch ### Logbuch
- Next: add rower to logbook - Next: Allow editing of rowers on "Ausfahrt beenden"
- Then
- Allow editing own logbook entries of same day
- Stats (Personenliste mit Gesamt-KM vom Jahr)
### Guest-Scheckbuch ### Guest-Scheckbuch
- guest_trip - guest_trip
@ -91,7 +94,7 @@ user_details
- [x] (remove) GET /remove/<trip_details_id> - [x] (remove) GET /remove/<trip_details_id>
- [x] (create) POST /cox/trip - [x] (create) POST /cox/trip
- [x] (update) POST /cox/trip/<trip_id> - [x] (update) POST /cox/trip/<trip_id>
- [ ] (join) GET /cox/join/<planned_event_id> - [x] (join) GET /cox/join/<planned_event_id>
- [ ] (remove) GET /cox/remove/<planned_event_id> - [ ] (remove) GET /cox/remove/<planned_event_id>
- [ ] (remove_trip) GET /cox/remove/trip/<trip_id> - [ ] (remove_trip) GET /cox/remove/trip/<trip_id>
- [ ] (index) GET /auth/ - [ ] (index) GET /auth/

View File

@ -103,7 +103,8 @@ CREATE TABLE IF NOT EXISTS "logbook" (
CREATE TABLE IF NOT EXISTS "rower" ( CREATE TABLE IF NOT EXISTS "rower" (
"logbook_id" INTEGER NOT NULL REFERENCES logbook(id), "logbook_id" INTEGER NOT NULL REFERENCES logbook(id),
"rower_id" INTEGER NOT NULL REFERENCES user(id) "rower_id" INTEGER NOT NULL REFERENCES user(id),
CONSTRAINT unq UNIQUE (logbook_id, rower_id)
); );
CREATE TABLE IF NOT EXISTS "boat_damage" ( CREATE TABLE IF NOT EXISTS "boat_damage" (

View File

@ -48,7 +48,22 @@ impl Boat {
// .await // .await
// .ok() // .ok()
// } // }
//
pub async fn is_locked(&self, db: &SqlitePool) -> bool {
sqlx::query!("SELECT * FROM boat_damage WHERE boat_id=? AND lock_boat=true AND user_id_verified is null", self.id).fetch_optional(db).await.unwrap().is_some()
}
pub async fn on_water(&self, db: &SqlitePool) -> bool {
sqlx::query!(
"SELECT * FROM logbook WHERE boat_id=? AND arrival is null",
self.id
)
.fetch_optional(db)
.await
.unwrap()
.is_some()
}
pub async fn all(db: &SqlitePool) -> Vec<Self> { pub async fn all(db: &SqlitePool) -> Vec<Self> {
sqlx::query_as!( sqlx::query_as!(
Boat, Boat,

View File

@ -1,10 +1,10 @@
use chrono::NaiveDateTime; use chrono::NaiveDateTime;
use serde::{Deserialize, Serialize}; use serde::Serialize;
use sqlx::{FromRow, SqlitePool}; use sqlx::{FromRow, SqlitePool};
use super::user::User; use super::{boat::Boat, rower::Rower, user::User};
#[derive(FromRow, Debug, Serialize, Deserialize)] #[derive(FromRow, Serialize, Clone)]
pub struct Logbook { pub struct Logbook {
pub id: i64, pub id: i64,
pub boat_id: i64, pub boat_id: i64,
@ -19,21 +19,13 @@ pub struct Logbook {
pub logtype: Option<i64>, pub logtype: Option<i64>,
} }
#[derive(Serialize, FromRow)] #[derive(Serialize)]
pub struct LogbookWithBoatAndUsers { pub struct LogbookWithBoatAndRowers {
pub id: i64, #[serde(flatten)]
pub boat_id: i64, pub logbook: Logbook,
pub shipmaster: i64, pub boat: Boat,
#[serde(default = "bool::default")] pub shipmaster_user: User,
pub shipmaster_only_steering: bool, pub rowers: Vec<User>,
pub departure: String, //TODO: Switch to chrono::nativedatetime
pub arrival: Option<String>, //TODO: Switch to chrono::nativedatetime
pub destination: Option<String>,
pub distance_in_km: Option<i64>,
pub comments: Option<String>,
pub logtype: Option<i64>,
pub boat: String,
pub shipmaster_name: String,
} }
pub enum LogbookUpdateError { pub enum LogbookUpdateError {
@ -43,6 +35,8 @@ pub enum LogbookUpdateError {
pub enum LogbookCreateError { pub enum LogbookCreateError {
BoatAlreadyOnWater, BoatAlreadyOnWater,
BoatLocked, BoatLocked,
BoatNotFound,
TooManyRowers(usize, usize),
} }
impl Logbook { impl Logbook {
@ -76,43 +70,61 @@ impl Logbook {
// .ok() // .ok()
// } // }
// //
pub async fn on_water(db: &SqlitePool) -> Vec<LogbookWithBoatAndUsers> { pub async fn on_water(db: &SqlitePool) -> Vec<LogbookWithBoatAndRowers> {
sqlx::query_as!( let logs = sqlx::query_as!(
LogbookWithBoatAndUsers, Logbook,
" "
SELECT logbook.id, boat_id, shipmaster, shipmaster_only_steering, departure, arrival, destination, distance_in_km, comments, logtype, boat.name as boat, user.name as shipmaster_name SELECT id, boat_id, shipmaster, shipmaster_only_steering, departure, arrival, destination, distance_in_km, comments, logtype
FROM logbook FROM logbook
INNER JOIN boat ON logbook.boat_id = boat.id
INNER JOIN user ON shipmaster = user.id
WHERE arrival is null WHERE arrival is null
ORDER BY departure DESC ORDER BY departure DESC
" "
) )
.fetch_all(db) .fetch_all(db)
.await .await
.unwrap() //TODO: fixme .unwrap(); //TODO: fixme
let mut ret = Vec::new();
for log in logs {
ret.push(LogbookWithBoatAndRowers {
rowers: Rower::for_log(db, &log).await,
boat: Boat::find_by_id(db, log.boat_id as i32).await.unwrap(),
shipmaster_user: User::find_by_id(db, log.shipmaster as i32).await.unwrap(),
logbook: log,
})
}
ret
} }
pub async fn completed(db: &SqlitePool) -> Vec<LogbookWithBoatAndUsers> { pub async fn completed(db: &SqlitePool) -> Vec<LogbookWithBoatAndRowers> {
sqlx::query_as!( let logs = sqlx::query_as!(
LogbookWithBoatAndUsers, Logbook,
" "
SELECT logbook.id, boat_id, shipmaster, shipmaster_only_steering, departure, arrival, destination, distance_in_km, comments, logtype, boat.name as boat, user.name as shipmaster_name SELECT id, boat_id, shipmaster, shipmaster_only_steering, departure, arrival, destination, distance_in_km, comments, logtype
FROM logbook FROM logbook
INNER JOIN boat ON logbook.boat_id = boat.id
INNER JOIN user ON shipmaster = user.id
WHERE arrival is not null WHERE arrival is not null
ORDER BY arrival DESC ORDER BY departure DESC
" "
) )
.fetch_all(db) .fetch_all(db)
.await .await
.unwrap() //TODO: fixme .unwrap(); //TODO: fixme
let mut ret = Vec::new();
for log in logs {
ret.push(LogbookWithBoatAndRowers {
rowers: Rower::for_log(db, &log).await,
boat: Boat::find_by_id(db, log.boat_id as i32).await.unwrap(),
shipmaster_user: User::find_by_id(db, log.shipmaster as i32).await.unwrap(),
logbook: log,
})
}
ret
} }
pub async fn create( pub async fn create(
db: &SqlitePool, db: &SqlitePool,
boat_id: i64, boat_id: i32,
shipmaster: i64, shipmaster: i64,
shipmaster_only_steering: bool, shipmaster_only_steering: bool,
departure: NaiveDateTime, departure: NaiveDateTime,
@ -121,15 +133,40 @@ impl Logbook {
distance_in_km: Option<i64>, distance_in_km: Option<i64>,
comments: Option<String>, comments: Option<String>,
logtype: Option<i64>, logtype: Option<i64>,
rower: Vec<i64>,
) -> Result<(), LogbookCreateError> { ) -> Result<(), LogbookCreateError> {
//Check if boat is not locked let boat = match Boat::find_by_id(db, boat_id).await {
//Check if boat is already on water Some(b) => b,
let _ = sqlx::query!( None => {
"INSERT INTO logbook(boat_id, shipmaster, shipmaster_only_steering, departure, arrival, destination, distance_in_km, comments, logtype) VALUES (?,?,?,?,?,?,?,?,?)", return Err(LogbookCreateError::BoatNotFound);
}
};
if boat.is_locked(db).await {
return Err(LogbookCreateError::BoatLocked);
}
if boat.on_water(db).await {
return Err(LogbookCreateError::BoatAlreadyOnWater);
}
if rower.len() > boat.amount_seats as usize - 1 {
return Err(LogbookCreateError::TooManyRowers(
boat.amount_seats as usize,
rower.len() + 1,
));
}
let inserted_row = sqlx::query!(
"INSERT INTO logbook(boat_id, shipmaster, shipmaster_only_steering, departure, arrival, destination, distance_in_km, comments, logtype) VALUES (?,?,?,?,?,?,?,?,?) RETURNING id",
boat_id, shipmaster, shipmaster_only_steering, departure, arrival, destination, distance_in_km, comments, logtype boat_id, shipmaster, shipmaster_only_steering, departure, arrival, destination, distance_in_km, comments, logtype
) )
.execute(db) .fetch_one(db)
.await; .await.unwrap();
for rower in &rower {
Rower::create(db, inserted_row.id, *rower).await;
}
Ok(()) Ok(())
} }

View File

@ -13,6 +13,7 @@ pub mod log;
pub mod logbook; pub mod logbook;
pub mod logtype; pub mod logtype;
pub mod planned_event; pub mod planned_event;
pub mod rower;
pub mod trip; pub mod trip;
pub mod tripdetails; pub mod tripdetails;
pub mod triptype; pub mod triptype;

134
src/model/rower.rs Normal file
View File

@ -0,0 +1,134 @@
use serde::{Deserialize, Serialize};
use sqlx::{FromRow, SqlitePool};
use super::{logbook::Logbook, user::User};
#[derive(FromRow, Debug, Serialize, Deserialize)]
pub struct Rower {
pub logbook_id: i64,
pub rower_id: i64,
}
impl Rower {
//pub async fn find_by_id(db: &SqlitePool, id: i32) -> Option<Self> {
// sqlx::query_as!(
// Self,
// "
//SELECT id,boat_id,shipmaster,shipmaster_only_steering,departure,arrival,destination,distance_in_km,comments,logtype
//FROM logbook
//WHERE id like ?
// ",
// id
// )
// .fetch_one(db)
// .await
// .ok()
//}
pub async fn for_log(db: &SqlitePool, log: &Logbook) -> Vec<User> {
sqlx::query_as!(
User,
"
SELECT id, name, pw, is_cox, is_admin, is_guest, deleted, last_access
FROM user
WHERE id in (SELECT rower_id FROM rower WHERE logbook_id=?)
",
log.id
)
.fetch_all(db)
.await
.unwrap()
}
pub async fn create(db: &SqlitePool, logbook_id: i64, rower_id: i64) {
//Check if boat is not locked
//Check if boat is already on water
let _ = sqlx::query!(
"INSERT INTO rower(logbook_id, rower_id) VALUES (?,?)",
logbook_id,
rower_id
)
.execute(db)
.await
.unwrap();
}
// pub async fn delete(&self, db: &SqlitePool) {
// sqlx::query!("DELETE FROM boat WHERE id=?", self.id)
// .execute(db)
// .await
// .unwrap(); //Okay, because we can only create a User of a valid id
// }
}
//
//#[cfg(test)]
//mod test {
// use crate::{model::boat::Boat, testdb};
//
// use sqlx::SqlitePool;
//
// #[sqlx::test]
// fn test_find_correct_id() {
// let pool = testdb!();
// let boat = Boat::find_by_id(&pool, 1).await.unwrap();
// assert_eq!(boat.id, 1);
// }
//
// #[sqlx::test]
// fn test_find_wrong_id() {
// let pool = testdb!();
// let boat = Boat::find_by_id(&pool, 1337).await;
// assert!(boat.is_none());
// }
//
// #[sqlx::test]
// fn test_all() {
// let pool = testdb!();
// let res = Boat::all(&pool).await;
// assert!(res.len() > 3);
// }
//
// #[sqlx::test]
// fn test_succ_create() {
// let pool = testdb!();
//
// assert_eq!(
// Boat::create(
// &pool,
// "new-boat-name".into(),
// 42,
// None,
// "Best Boatbuilder".into(),
// true,
// true,
// false,
// Some(1),
// None
// )
// .await,
// true
// );
// }
//
// #[sqlx::test]
// fn test_duplicate_name_create() {
// let pool = testdb!();
//
// assert_eq!(
// Boat::create(
// &pool,
// "Haichenbach".into(),
// 42,
// None,
// "Best Boatbuilder".into(),
// true,
// true,
// false,
// Some(1),
// None
// )
// .await,
// false
// );
// }
//}

View File

@ -20,12 +20,12 @@ use super::{tripdetails::TripDetails, Day};
pub struct User { pub struct User {
pub id: i64, pub id: i64,
pub name: String, pub name: String,
pw: Option<String>, pub pw: Option<String>,
pub is_cox: bool, pub is_cox: bool,
pub is_admin: bool, pub is_admin: bool,
pub is_guest: bool, pub is_guest: bool,
#[serde(default = "bool::default")] #[serde(default = "bool::default")]
deleted: bool, pub deleted: bool,
pub last_access: Option<chrono::NaiveDateTime>, pub last_access: Option<chrono::NaiveDateTime>,
} }

View File

@ -345,4 +345,107 @@ mod test {
assert_eq!(flash_cookie.value(), "5:errorNicht deine Ausfahrt!"); assert_eq!(flash_cookie.value(), "5:errorNicht deine Ausfahrt!");
} }
#[sqlx::test]
fn test_trip_join() {
let db = testdb!();
let rocket = rocket::build().manage(db.clone());
let rocket = crate::tera::config(rocket);
let client = Client::tracked(rocket).await.unwrap();
let login = client
.post("/auth")
.header(ContentType::Form) // Set the content type to form
.body("name=cox&password=cox"); // Add the form data to the request body;
login.dispatch().await;
let req = client.get("/cox/join/1");
let response = req.dispatch().await;
assert_eq!(response.status(), Status::SeeOther);
assert_eq!(response.headers().get("Location").next(), Some("/"));
let flash_cookie = response
.cookies()
.get("_flash")
.expect("Expected flash cookie");
assert_eq!(flash_cookie.value(), "7:successDanke für's helfen!");
let req = client.get("/cox/join/1");
let response = req.dispatch().await;
assert_eq!(response.status(), Status::SeeOther);
assert_eq!(response.headers().get("Location").next(), Some("/"));
let flash_cookie = response
.cookies()
.get("_flash")
.expect("Expected flash cookie");
assert_eq!(flash_cookie.value(), "5:errorDu hilfst bereits aus!");
}
#[sqlx::test]
fn test_trip_join_already_rower() {
let db = testdb!();
let rocket = rocket::build().manage(db.clone());
let rocket = crate::tera::config(rocket);
let client = Client::tracked(rocket).await.unwrap();
let login = client
.post("/auth")
.header(ContentType::Form) // Set the content type to form
.body("name=cox&password=cox"); // Add the form data to the request body;
login.dispatch().await;
let req = client.get("/join/1");
let response = req.dispatch().await;
let req = client.get("/cox/join/1");
let response = req.dispatch().await;
assert_eq!(response.status(), Status::SeeOther);
assert_eq!(response.headers().get("Location").next(), Some("/"));
let flash_cookie = response
.cookies()
.get("_flash")
.expect("Expected flash cookie");
assert_eq!(
flash_cookie.value(),
"5:errorDu hast dich bereits als Ruderer angemeldet!"
);
}
#[sqlx::test]
fn test_trip_join_invalid_event() {
let db = testdb!();
let rocket = rocket::build().manage(db.clone());
let rocket = crate::tera::config(rocket);
let client = Client::tracked(rocket).await.unwrap();
let login = client
.post("/auth")
.header(ContentType::Form) // Set the content type to form
.body("name=cox&password=cox"); // Add the form data to the request body;
login.dispatch().await;
let req = client.get("/cox/join/9999");
let response = req.dispatch().await;
assert_eq!(response.status(), Status::SeeOther);
assert_eq!(response.headers().get("Location").next(), Some("/"));
let flash_cookie = response
.cookies()
.get("_flash")
.expect("Expected flash cookie");
assert_eq!(flash_cookie.value(), "5:errorEvent gibt's nicht");
}
} }

View File

@ -12,7 +12,7 @@ use tera::Context;
use crate::model::{ use crate::model::{
boat::Boat, boat::Boat,
logbook::Logbook, logbook::{Logbook, LogbookCreateError},
logtype::LogType, logtype::LogType,
user::{AdminUser, User}, user::{AdminUser, User},
}; };
@ -24,7 +24,8 @@ async fn index(
adminuser: AdminUser, adminuser: AdminUser,
) -> Template { ) -> Template {
let boats = Boat::all(db).await; let boats = Boat::all(db).await;
let users = User::cox(db).await; let coxes = User::cox(db).await;
let users = User::all(db).await;
let logtypes = LogType::all(db).await; let logtypes = LogType::all(db).await;
let on_water = Logbook::on_water(db).await; let on_water = Logbook::on_water(db).await;
@ -36,6 +37,7 @@ async fn index(
} }
context.insert("boats", &boats); context.insert("boats", &boats);
context.insert("coxes", &coxes);
context.insert("users", &users); context.insert("users", &users);
context.insert("logtypes", &logtypes); context.insert("logtypes", &logtypes);
context.insert("loggedin_user", &adminuser.user); context.insert("loggedin_user", &adminuser.user);
@ -47,7 +49,7 @@ async fn index(
#[derive(FromForm)] #[derive(FromForm)]
struct LogAddForm { struct LogAddForm {
boat_id: i64, boat_id: i32,
shipmaster: i64, shipmaster: i64,
shipmaster_only_steering: bool, shipmaster_only_steering: bool,
departure: String, departure: String,
@ -56,6 +58,7 @@ struct LogAddForm {
distance_in_km: Option<i64>, distance_in_km: Option<i64>,
comments: Option<String>, comments: Option<String>,
logtype: Option<i64>, logtype: Option<i64>,
rower: Vec<i64>,
} }
#[post("/", data = "<data>")] #[post("/", data = "<data>")]
@ -77,14 +80,16 @@ async fn create(
data.distance_in_km, data.distance_in_km,
data.comments.clone(), //TODO: fix data.comments.clone(), //TODO: fix
data.logtype, data.logtype,
data.rower.clone(), //TODO: fix
) )
.await .await
{ {
Ok(_) => Flash::success(Redirect::to("/log"), "Ausfahrt erfolgreich hinzugefügt"), Ok(_) => Flash::success(Redirect::to("/log"), "Ausfahrt erfolgreich hinzugefügt"),
Err(_) => Flash::error(Redirect::to("/log"), format!("Fehler beim hinzufügen!")) Err(LogbookCreateError::BoatAlreadyOnWater) => Flash::error(Redirect::to("/log"), format!("Boot schon am Wasser")),
Err(LogbookCreateError::BoatLocked) => Flash::error(Redirect::to("/log"), format!("Boot gesperrt")),
Err(LogbookCreateError::BoatNotFound) => Flash::error(Redirect::to("/log"), format!("Boot gibt's ned")),
Err(LogbookCreateError::TooManyRowers(expected, actual)) => Flash::error(Redirect::to("/log"), format!("Zu viele Ruderer (Boot fasst maximal {expected}, es wurden jedoch {actual} Ruderer ausgewählt)")),
} }
} }
#[derive(FromForm)] #[derive(FromForm)]
@ -117,22 +122,18 @@ async fn home(
data.destination.clone(), //TODO: fixme data.destination.clone(), //TODO: fixme
data.distance_in_km, data.distance_in_km,
data.comments.clone(), //TODO: fixme data.comments.clone(), //TODO: fixme
data.logtype data.logtype,
) )
.await .await
{ {
Ok(_) => Flash::success(Redirect::to("/log"), "Successfully updated log"), Ok(_) => Flash::success(Redirect::to("/log"), "Successfully updated log"),
Err(_) => Err(_) => Flash::error(
Flash::error(
Redirect::to("/log"), Redirect::to("/log"),
format!("Logbook with ID {} could not be updated!", logbook_id), format!("Logbook with ID {} could not be updated!", logbook_id),
) ),
} }
} }
pub fn routes() -> Vec<Route> { pub fn routes() -> Vec<Route> {
routes![index, create, home] routes![index, create, home]
} }

View File

@ -13,7 +13,7 @@
<h2>Neue Ausfahrt starten</h2> <h2>Neue Ausfahrt starten</h2>
<form action="/log" method="post" id="form"> <form action="/log" method="post" id="form">
{{ macros::select(data=boats, select_name='boat_id') }} {{ macros::select(data=boats, select_name='boat_id') }}
{{ macros::select(data=users, select_name='shipmaster', selected_id=loggedin_user.id) }} {{ macros::select(data=coxes, select_name='shipmaster', selected_id=loggedin_user.id) }}
{{ macros::checkbox(label='shipmaster_only_steering', name='shipmaster_only_steering') }} <!-- TODO: depending on boat, deselect by default --> {{ macros::checkbox(label='shipmaster_only_steering', name='shipmaster_only_steering') }} <!-- TODO: depending on boat, deselect by default -->
Departure: <input type="datetime-local" id="datetime-dep" value="2023-07-24T08:00" name="departure" required/> Departure: <input type="datetime-local" id="datetime-dep" value="2023-07-24T08:00" name="departure" required/>
Arrival: <input type="datetime-local" id="datetime-arr" name="arrival" /> Arrival: <input type="datetime-local" id="datetime-arr" name="arrival" />
@ -35,6 +35,11 @@
{{ macros::input(label="Distanz", name="distance_in_km", type="number", min=0) }} {{ macros::input(label="Distanz", name="distance_in_km", type="number", min=0) }}
{{ macros::input(label="Kommentar", name="comments", type="text") }} {{ macros::input(label="Kommentar", name="comments", type="text") }}
{{ macros::select(data=logtypes, select_name='logtype', default="Normal") }} {{ macros::select(data=logtypes, select_name='logtype', default="Normal") }}
<select multiple="multiple" name="rower[]">
{% for user in users %}
<option value="{{ user.id }}" onmousedown="event.preventDefault(); this.selected = !this.selected; return false;">{{user.name}}</option>
{% endfor %}
</select>
<input type="submit" /> <input type="submit" />
<script> <script>
@ -53,8 +58,8 @@
<h2 style="font-size: 100px">Am Wasser</h2> <h2 style="font-size: 100px">Am Wasser</h2>
{% for log in on_water %} {% for log in on_water %}
Bootsname: {{ log.boat }}<br /> Bootsname: {{ log.boat.name }}<br />
Schiffsführer: {{ log.shipmaster_name }}<br /> Schiffsführer: {{ log.shipmaster_user.name }}<br />
{% if log.shipmaster_only_steering %} {% if log.shipmaster_only_steering %}
Schiffsführer steuert nur Schiffsführer steuert nur
{% endif %} {% endif %}
@ -62,6 +67,13 @@
Ziel: {{ log.destination }}<br /> Ziel: {{ log.destination }}<br />
Kommentare: {{ log.comments }}<br /> Kommentare: {{ log.comments }}<br />
Logtype: {{ log.logtype }}<br /> Logtype: {{ log.logtype }}<br />
Ruderer:
{% for rower in log.rowers %}
{{ rower.name }}
{% endfor %}
{% set amount_rowers = log.rowers | length %}
{% set amount_guests = log.boat.amount_seats - amount_rowers -1 %}
{{ amount_guests }} Gäste (ohne Account)
{% if log.shipmaster == loggedin_user.id %} {% if log.shipmaster == loggedin_user.id %}
<form action="/log/{{log.id}}" method="post"> <form action="/log/{{log.id}}" method="post">
Destination: <input type="search" list="destinations" placeholder="Destination" id="destination-home" name="destination" value="{{log.destination}}" oninput="var inputElement = document.getElementById('destination-home'); Destination: <input type="search" list="destinations" placeholder="Destination" id="destination-home" name="destination" value="{{log.destination}}" oninput="var inputElement = document.getElementById('destination-home');
@ -85,11 +97,18 @@
<h2 style="font-size: 100px">Einträge</h2> <h2 style="font-size: 100px">Einträge</h2>
{% for log in completed %} {% for log in completed %}
Bootsname: {{ log.boat }}<br /> Bootsname: {{ log.boat.name }}<br />
Schiffsführer: {{ log.shipmaster_name }}<br /> Schiffsführer: {{ log.shipmaster_user.name }}<br />
{% if log.shipmaster_only_steering %} {% if log.shipmaster_only_steering %}
Schiffsführer steuert nur Schiffsführer steuert nur
{% endif %} {% endif %}
Ruderer:
{% for rower in log.rowers %}
{{ rower.name }}
{% endfor %}
{% set amount_rowers = log.rowers | length %}
{% set amount_guests = log.boat.amount_seats - amount_rowers -1 %}
{{ amount_guests }} Gäste (ohne Account)
Weggefahren: {{ log.departure }}<br /> Weggefahren: {{ log.departure }}<br />
Angekommen: {{ log.arrival}}<br /> Angekommen: {{ log.arrival}}<br />
Ziel: {{ log.destination }}<br /> Ziel: {{ log.destination }}<br />