aboutsummaryrefslogtreecommitdiffstats
path: root/pydis_site
diff options
context:
space:
mode:
Diffstat (limited to 'pydis_site')
-rw-r--r--pydis_site/apps/api/models/bot/metricity.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/pydis_site/apps/api/models/bot/metricity.py b/pydis_site/apps/api/models/bot/metricity.py
index 93d0df71..81d6e788 100644
--- a/pydis_site/apps/api/models/bot/metricity.py
+++ b/pydis_site/apps/api/models/bot/metricity.py
@@ -49,12 +49,15 @@ class Metricity:
def total_message_blocks(self, user_id: str) -> int:
"""Query number of 10 minute blocks the user has been active during."""
self.cursor.execute(
- """
+ f"""
SELECT
COUNT(*)
FROM (
SELECT
- to_timestamp(floor((extract('epoch' from created_at) / 600 )) * 600)
+ to_timestamp(
+ floor((extract('epoch' from created_at) / {BLOCK_INTERVAL} ))
+ * {BLOCK_INTERVAL}
+ )
AT TIME ZONE 'UTC' AS interval
FROM messages
WHERE