Compare commits

..

2 Commits

Author SHA1 Message Date
d731f97169 Merge pull request 'only show donauLinz user in stats, otherwise count as guest' (#206) from staging into main
All checks were successful
CI/CD Pipeline / test (push) Successful in 8m57s
CI/CD Pipeline / deploy-staging (push) Has been skipped
CI/CD Pipeline / deploy-main (push) Successful in 3m31s
Reviewed-on: #206
2024-02-12 20:10:03 +01:00
0231d2bd21 only show donauLinz user in stats, otherwise count as guest
All checks were successful
CI/CD Pipeline / test (push) Successful in 9m8s
CI/CD Pipeline / deploy-staging (push) Successful in 3m47s
CI/CD Pipeline / deploy-main (push) Has been skipped
2024-02-12 20:09:30 +01:00

View File

@ -62,13 +62,18 @@ WHERE l.distance_in_km IS NOT NULL AND l.arrival LIKE '{year}-%' AND b.name != '
let rowed_km_guests = sqlx::query(&format!( let rowed_km_guests = sqlx::query(&format!(
" "
SELECT CAST(SUM(l.distance_in_km) AS INTEGER) AS rowed_km SELECT CAST(SUM(l.distance_in_km) AS INTEGER) AS rowed_km
FROM user u FROM user u
INNER JOIN rower r ON u.id = r.rower_id INNER JOIN rower r ON u.id = r.rower_id
INNER JOIN logbook l ON r.logbook_id = l.id INNER JOIN logbook l ON r.logbook_id = l.id
INNER JOIN user_role ur ON u.id = ur.user_id WHERE u.id NOT IN (
INNER JOIN role ro ON ur.role_id = ro.id SELECT ur.user_id
WHERE ro.name = 'scheckbuch' AND l.distance_in_km IS NOT NULL AND l.arrival LIKE '{year}-%'; FROM user_role ur
INNER JOIN role ro ON ur.role_id = ro.id
WHERE ro.name = 'Donau Linz'
)
AND l.distance_in_km IS NOT NULL
AND l.arrival LIKE '{year}-%';
" "
)) ))
.fetch_one(db) .fetch_one(db)
@ -93,10 +98,10 @@ WHERE ro.name = 'scheckbuch' AND l.distance_in_km IS NOT NULL AND l.arrival LIKE
SELECT u.name, CAST(SUM(l.distance_in_km) AS INTEGER) AS rowed_km SELECT u.name, CAST(SUM(l.distance_in_km) AS INTEGER) AS rowed_km
FROM ( FROM (
SELECT * FROM user SELECT * FROM user
WHERE id NOT IN ( WHERE id IN (
SELECT user_id FROM user_role SELECT user_id FROM user_role
JOIN role ON user_role.role_id = role.id JOIN role ON user_role.role_id = role.id
WHERE role.name = 'scheckbuch' WHERE role.name = 'Donau Linz'
) )
) u ) u
INNER JOIN rower r ON u.id = r.rower_id INNER JOIN rower r ON u.id = r.rower_id