|
| 1 | +\c queuesystem \echo '\n\n\nGetting all time count for the amount of users of the queue system' |
| 2 | +select count (u.ugkthid) |
| 3 | +from users u; |
| 4 | + |
| 5 | +\echo '\n\n\nGetting all time count for the amount times people entered the queue system' |
| 6 | +select count(distinct u.id) |
| 7 | +from user_events u |
| 8 | +where u.left_queue=false; |
| 9 | + |
| 10 | +\echo '\n\n\nGetting all the amount unique people entered the queue system during the last 12 months' |
| 11 | +select count(distinct us.id) |
| 12 | +from user_events u |
| 13 | +inner join users us on us.id = u.user_id |
| 14 | +where u.left_queue=false |
| 15 | + and date(u.time) > (current_date - '1 year'::interval); |
| 16 | + |
| 17 | +\echo '\n\n\nGetting all the amount times people entered the queue system during the last 12 months' |
| 18 | +select count(distinct u.id) |
| 19 | +from user_events u |
| 20 | +where u.left_queue=false |
| 21 | + and date(u.time) > (current_date - '1 year'::interval); |
| 22 | + |
| 23 | +\echo '\n\n\nGetting the queues that has had no entries during the last year, candidates for lock/hide' |
| 24 | +select q.name |
| 25 | +from queues q |
| 26 | +left join |
| 27 | + (select * |
| 28 | + from user_events |
| 29 | + where date(user_events.time) > (current_date - '1 year'::interval)) u on q.id = u.queue_id |
| 30 | +where u.user_id is null; |
| 31 | + |
| 32 | +\echo '\n\n\nGetting the queues that has had no entries during the last 24 months, candidates for hide/delete' |
| 33 | +select q.name |
| 34 | +from queues q |
| 35 | +left join |
| 36 | + (select * |
| 37 | + from user_events |
| 38 | + where date(user_events.time) > (current_date - '2 year'::interval)) u on q.id = u.queue_id |
| 39 | +where u.user_id is null; |
| 40 | + |
| 41 | +\echo '\n\n\nGetting the queues that has had no entries ever, candidates for delete' |
| 42 | +select q.name |
| 43 | +from queues q |
| 44 | +left join user_events u on q.id = u.queue_id |
| 45 | +where u.user_id is null; |
| 46 | + |
| 47 | +/* |
| 48 | +May 2021 list |
| 49 | + PPM |
| 50 | + Beslut |
| 51 | + Automat |
| 52 | + DD2419 |
| 53 | + Xmlpub |
| 54 | + Dbtek |
| 55 | + OOP |
| 56 | + MI |
| 57 | + pallinda |
| 58 | + maskin |
| 59 | + IR |
| 60 | + Sprakt |
| 61 | + Sudata |
| 62 | + DD2380 |
| 63 | + DM2518 |
| 64 | + PDC Summer School |
| 65 | + prgciteh |
| 66 | + DT1130 |
| 67 | + Semant |
| 68 | + DD1346 |
| 69 | + Qmisk |
| 70 | + */ |
0 commit comments