Compare commits

...

3 Commits

Author SHA1 Message Date
d3bc2bea4f 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
2024-04-06 20:00:25 +02:00
37fcdb81bc remove unnecessary if
All checks were successful
CI/CD Pipeline / test (push) Successful in 11m32s
CI/CD Pipeline / deploy-staging (push) Successful in 6m48s
CI/CD Pipeline / deploy-main (push) Has been skipped
2024-04-06 19:57:42 +02:00
b3041d9ca7 also show boats w/o any km
Some checks failed
CI/CD Pipeline / deploy-staging (push) Blocked by required conditions
CI/CD Pipeline / deploy-main (push) Blocked by required conditions
CI/CD Pipeline / test (push) Has been cancelled
2024-04-06 19:56:06 +02:00

View File

@ -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', arrival) 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)