limit-users-to-proper-roles #156

Merged
philipp merged 11 commits from limit-users-to-proper-roles into staging 2024-01-10 14:55:43 +01:00
Showing only changes of commit 251c83eb30 - Show all commits

View File

@ -58,11 +58,25 @@ WHERE l.distance_in_km IS NOT NULL AND l.arrival LIKE '{year}-%' AND b.name != '
.fetch_one(db)
.await
.unwrap()
.get::<i64, usize>(0);
.get::<i64, usize>(0) as i32;
let rowed_km_guests = sqlx::query(&format!(
"
SELECT 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 = 1 AND l.distance_in_km IS NOT NULL AND l.arrival LIKE '{year}-%';
"
))
.fetch_one(db)
.await
.unwrap()
.get::<i64, usize>(0) as i32;
Stat {
name: "Gäste".into(),
rowed_km: rowed_km as i32,
rowed_km: rowed_km + rowed_km_guests,
}
}