also show boats w/o any km
This commit is contained in:
parent
8b07ace876
commit
b3041d9ca7
@ -27,23 +27,23 @@ impl BoatStat {
|
|||||||
|
|
||||||
let rows = sqlx::query(
|
let rows = sqlx::query(
|
||||||
"
|
"
|
||||||
SELECT
|
SELECT
|
||||||
boat.id,
|
boat.id,
|
||||||
location.name AS location,
|
location.name AS location,
|
||||||
CAST(strftime('%Y', arrival) AS INTEGER) AS year,
|
CAST(strftime('%Y', COALESCE(arrival, 'now')) AS INTEGER) AS year,
|
||||||
CAST(SUM(distance_in_km) AS INTEGER) AS rowed_km
|
CAST(SUM(COALESCE(distance_in_km, 0)) AS INTEGER) AS rowed_km
|
||||||
FROM
|
FROM
|
||||||
logbook
|
boat
|
||||||
INNER JOIN
|
LEFT JOIN
|
||||||
boat ON boat.id = logbook.boat_id
|
logbook ON boat.id = logbook.boat_id AND logbook.arrival IS NOT NULL
|
||||||
INNER JOIN
|
LEFT JOIN
|
||||||
location ON boat.location_id = location.id
|
location ON boat.location_id = location.id
|
||||||
WHERE
|
WHERE
|
||||||
boat.name != 'Externes Boot'
|
boat.name != 'Externes Boot'
|
||||||
GROUP BY
|
GROUP BY
|
||||||
boat_id, year
|
boat.id, year
|
||||||
ORDER BY
|
ORDER BY
|
||||||
boat.name, year DESC;
|
boat.name, year DESC;
|
||||||
",
|
",
|
||||||
)
|
)
|
||||||
.fetch_all(db)
|
.fetch_all(db)
|
||||||
|
Loading…
Reference in New Issue
Block a user