Compare commits

..

6 Commits

Author SHA1 Message Date
5cfaf44a79 Merge pull request 'fix-stat' (#149) from fix-stat into main
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
Reviewed-on: #149
2024-01-05 20:39:02 +01:00
1c020da84f fix stat
Some checks failed
CI/CD Pipeline / deploy-staging (push) Has been cancelled
CI/CD Pipeline / deploy-main (push) Has been cancelled
CI/CD Pipeline / test (push) Has been cancelled
2024-01-05 20:37:40 +01:00
323f6da201 Merge pull request 'show guests km' (#146) from show-guests-km into staging
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
Reviewed-on: #146
2024-01-05 20:08:47 +01:00
248ab95ae9 Merge pull request 'fix tests, as we now show all boats in kiosk mode' (#142) from fix-ci into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 15m27s
CI/CD Pipeline / deploy-staging (push) Successful in 17m56s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #142
2024-01-04 20:47:47 +01:00
571e80085f Merge pull request 'allow to add logbook entries up to a week late; show all boats in boatshouse; don't show guests for external boats' (#140) from fixes into staging
Some checks failed
CI/CD Pipeline / test (push) Has been cancelled
CI/CD Pipeline / deploy-staging (push) Has been cancelled
CI/CD Pipeline / deploy-main (push) Has been cancelled
Reviewed-on: #140
2024-01-04 20:44:06 +01:00
b73ae788e6 Merge pull request 'fix weird iphone issue' (#137) from fix-weird-iphone-issue into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 15m22s
CI/CD Pipeline / deploy-staging (push) Successful in 17m34s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #137
2024-01-03 10:00:10 +01:00

View File

@ -66,7 +66,9 @@ 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}-%';
INNER JOIN user_role ur ON u.id = ur.user_id
INNER JOIN role ro ON ur.role_id = ro.id
WHERE ro.name = 'scheckbuch' AND l.distance_in_km IS NOT NULL AND l.arrival LIKE '{year}-%';
"
))
.fetch_one(db)
@ -89,10 +91,17 @@ WHERE u.is_guest = 1 AND l.distance_in_km IS NOT NULL AND l.arrival LIKE '{year}
sqlx::query(&format!(
"
SELECT u.name, CAST(SUM(l.distance_in_km) AS INTEGER) AS rowed_km
FROM user u
FROM (
SELECT * FROM user
WHERE id NOT IN (
SELECT user_id FROM user_role
JOIN role ON user_role.role_id = role.id
WHERE role.name = 'scheckbuch'
)
) 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 '{year}-%'
WHERE l.distance_in_km IS NOT NULL AND l.arrival LIKE '{year}-%'
GROUP BY u.name
ORDER BY rowed_km DESC;
"