cleaner code thanks to clippy
All checks were successful
CI/CD Pipeline / test (push) Successful in 10m54s
CI/CD Pipeline / deploy-staging (push) Has been skipped
CI/CD Pipeline / deploy-main (push) Has been skipped

This commit is contained in:
2023-11-27 12:49:36 +01:00
parent 99fb9c624d
commit 861262b62b
3 changed files with 7 additions and 8 deletions

View File

@ -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
registered_at: r.registered_at,
is_guest: r.is_guest,
is_real_guest: r.user_id == None,
is_real_guest: r.user_id.is_none(),
})
.collect()
}

View File

@ -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
FROM logbook
WHERE arrival LIKE '{}-%'
WHERE arrival LIKE '{year}-%'
GROUP BY boat_id
ORDER BY rowed_km DESC;
",year)
")
)
.fetch_all(db)
.await
@ -48,11 +48,10 @@ SELECT u.name, CAST(SUM(l.distance_in_km) AS INTEGER) AS rowed_km
FROM user u
INNER JOIN rower r ON u.id = r.rower_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
ORDER BY rowed_km DESC;
",
year
"
))
.fetch_all(db)
.await