Merge pull request 'staging' (#345) from staging into main
All checks were successful
CI/CD Pipeline / test (push) Successful in 11m25s
CI/CD Pipeline / deploy-staging (push) Has been skipped
CI/CD Pipeline / deploy-main (push) Successful in 5m38s

Reviewed-on: #345
This commit is contained in:
philipp 2024-04-06 20:00:25 +02:00
commit d3bc2bea4f

View File

@ -27,22 +27,22 @@ impl BoatStat {
let rows = sqlx::query(
"
SELECT
SELECT
boat.id,
location.name AS location,
CAST(strftime('%Y', arrival) AS INTEGER) AS year,
CAST(SUM(distance_in_km) AS INTEGER) AS rowed_km
FROM
logbook
INNER JOIN
boat ON boat.id = logbook.boat_id
INNER JOIN
CAST(SUM(COALESCE(distance_in_km, 0)) AS INTEGER) AS rowed_km
FROM
boat
LEFT JOIN
logbook ON boat.id = logbook.boat_id AND logbook.arrival IS NOT NULL
LEFT JOIN
location ON boat.location_id = location.id
WHERE
WHERE
boat.name != 'Externes Boot'
GROUP BY
boat_id, year
ORDER BY
GROUP BY
boat.id, year
ORDER BY
boat.name, year DESC;
",
)