1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00

Fix cvstats query

This commit is contained in:
Steffo 2020-06-04 18:01:47 +02:00
parent d2c5b11682
commit 33ce001a6f
Signed by: steffo
GPG key ID: 896A80F55F7C97F0

View file

@ -63,9 +63,7 @@ JOIN
AVG(c.members_total) members_total, AVG(c.members_total) members_total,
AVG(c.users_total) users_total AVG(c.users_total) users_total
FROM cvstats c FROM cvstats c
WHERE c.timestamp BETWEEN WHERE c.timestamp > current_timestamp - interval '7 day'
NOW()::DATE-EXTRACT(DOW FROM NOW())::INTEGER-7
AND NOW()::DATE-EXTRACT(DOW from NOW())::INTEGER
GROUP BY h GROUP BY h
) c ) c
GROUP BY ph GROUP BY ph
@ -92,9 +90,7 @@ JOIN
AVG(c.members_total) members_total, AVG(c.members_total) members_total,
AVG(c.users_total) users_total AVG(c.users_total) users_total
FROM cvstats c FROM cvstats c
WHERE c.timestamp BETWEEN WHERE c.timestamp > current_timestamp - interval '30 day'
NOW()::DATE-EXTRACT(DOW FROM NOW())::INTEGER-30
AND NOW()::DATE-EXTRACT(DOW from NOW())::INTEGER
GROUP BY h GROUP BY h
) c ) c
GROUP BY ph GROUP BY ph
@ -121,9 +117,7 @@ JOIN
AVG(c.members_total) members_total, AVG(c.members_total) members_total,
AVG(c.users_total) users_total AVG(c.users_total) users_total
FROM cvstats c FROM cvstats c
WHERE c.timestamp BETWEEN WHERE c.timestamp > current_timestamp - interval '1 day'
NOW()::DATE-EXTRACT(DOW FROM NOW())::INTEGER-1
AND NOW()::DATE-EXTRACT(DOW from NOW())::INTEGER
GROUP BY h GROUP BY h
) c ) c
GROUP BY ph GROUP BY ph