Compare commits
2 Commits
99fb9c624d
...
7193760f05
Author | SHA1 | Date | |
---|---|---|---|
7193760f05 | |||
861262b62b |
@ -67,7 +67,7 @@ FROM user_trip WHERE trip_details_id = ?
|
|||||||
name: r.name.or(r.user_note).unwrap(), //Ok, either name or user_note needs to be set
|
name: r.name.or(r.user_note).unwrap(), //Ok, either name or user_note needs to be set
|
||||||
registered_at: r.registered_at,
|
registered_at: r.registered_at,
|
||||||
is_guest: r.is_guest,
|
is_guest: r.is_guest,
|
||||||
is_real_guest: r.user_id == None,
|
is_real_guest: r.user_id.is_none(),
|
||||||
})
|
})
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
@ -20,10 +20,10 @@ impl Stat {
|
|||||||
"
|
"
|
||||||
SELECT (SELECT name FROM boat WHERE id=logbook.boat_id) as name, CAST(SUM(distance_in_km) AS INTEGER) AS rowed_km
|
SELECT (SELECT name FROM boat WHERE id=logbook.boat_id) as name, CAST(SUM(distance_in_km) AS INTEGER) AS rowed_km
|
||||||
FROM logbook
|
FROM logbook
|
||||||
WHERE arrival LIKE '{}-%'
|
WHERE arrival LIKE '{year}-%'
|
||||||
GROUP BY boat_id
|
GROUP BY boat_id
|
||||||
ORDER BY rowed_km DESC;
|
ORDER BY rowed_km DESC;
|
||||||
",year)
|
")
|
||||||
)
|
)
|
||||||
.fetch_all(db)
|
.fetch_all(db)
|
||||||
.await
|
.await
|
||||||
@ -48,11 +48,10 @@ SELECT u.name, CAST(SUM(l.distance_in_km) AS INTEGER) AS rowed_km
|
|||||||
FROM user u
|
FROM user u
|
||||||
INNER JOIN rower r ON u.id = r.rower_id
|
INNER JOIN rower r ON u.id = r.rower_id
|
||||||
INNER JOIN logbook l ON r.logbook_id = l.id
|
INNER JOIN logbook l ON r.logbook_id = l.id
|
||||||
WHERE u.is_guest = 0 AND l.distance_in_km IS NOT NULL AND l.arrival LIKE '{}-%'
|
WHERE u.is_guest = 0 AND l.distance_in_km IS NOT NULL AND l.arrival LIKE '{year}-%'
|
||||||
GROUP BY u.name
|
GROUP BY u.name
|
||||||
ORDER BY rowed_km DESC;
|
ORDER BY rowed_km DESC;
|
||||||
",
|
"
|
||||||
year
|
|
||||||
))
|
))
|
||||||
.fetch_all(db)
|
.fetch_all(db)
|
||||||
.await
|
.await
|
||||||
|
@ -182,7 +182,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"), format!("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).")),
|
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)."),
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -252,7 +252,7 @@ async fn home_logbook(
|
|||||||
match logbook.home(db, &user.user, data.into_inner()).await {
|
match logbook.home(db, &user.user, data.into_inner()).await {
|
||||||
Ok(_) => Flash::success(Redirect::to("/log"), "Ausfahrt korrekt eingetragen"),
|
Ok(_) => Flash::success(Redirect::to("/log"), "Ausfahrt korrekt eingetragen"),
|
||||||
Err(LogbookUpdateError::TooManyRowers(expected, actual)) => Flash::error(Redirect::to("/log"), format!("Zu viele Ruderer (Boot fasst maximal {expected}, es wurden jedoch {actual} Ruderer ausgewählt)")),
|
Err(LogbookUpdateError::TooManyRowers(expected, actual)) => Flash::error(Redirect::to("/log"), format!("Zu viele Ruderer (Boot fasst maximal {expected}, es wurden jedoch {actual} Ruderer ausgewählt)")),
|
||||||
Err(LogbookUpdateError::OnlyAllowedToEndTripsEndingToday) => Flash::error(Redirect::to("/log"), format!("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).")),
|
Err(LogbookUpdateError::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)."),
|
||||||
Err(e) => Flash::error(
|
Err(e) => Flash::error(
|
||||||
Redirect::to("/log"),
|
Redirect::to("/log"),
|
||||||
format!("Eintrag {logbook_id} konnte nicht abgesendet werden (Fehler: {e:?})!"),
|
format!("Eintrag {logbook_id} konnte nicht abgesendet werden (Fehler: {e:?})!"),
|
||||||
|
Loading…
Reference in New Issue
Block a user