Adding query for Toad

Query to get users who have never played
This commit is contained in:
zoevig 2022-02-09 12:53:19 +00:00 committed by GitHub
parent 9be2cd1b0f
commit 6e96e7db08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 25 additions and 0 deletions

View File

@ -55,6 +55,31 @@ AND r.attrs ->> 'games' IS NOT NULL
ORDER BY r.attrs ->> 'score' ASC;
```
The following query returns all the users who signed in to the platform at least one and have never started the games.
```sql
SELECT *
FROM public.user
WHERE ((NOT ((EXISTS (
SELECT 1
FROM public.progress AS p
WHERE p."userId" = public.user.id)))
AND (((NOT (EXISTS (
SELECT 1
FROM toad.sessions AS s
WHERE s."candidate_id" = public.user.id)
OR (EXISTS (
SELECT 1
FROM toad.sessions AS s
WHERE (s.candidate_id = public.user.id
AND s.started_at IS NULL)))))
AND (NOT ((EXISTS (
SELECT 1
FROM public.user_roles_view AS r
WHERE (r."userId" = public.user.id
AND r.slug IN ('admin', 'campus_admin_gritlab'))))))))))
```
### Administration
The following query returns the users currently in the administration process. This includes all information about the user, the number of attempts and the current phase.