aboutsummaryrefslogtreecommitdiffstats
path: root/pydis_site/apps/api/models
diff options
context:
space:
mode:
authorGravatar Joe Banks <[email protected]>2020-10-27 02:11:30 +0000
committerGravatar Joe Banks <[email protected]>2020-10-27 02:11:30 +0000
commit8c7eab5966089a64dcf0899c4f5c28462f745cdb (patch)
tree60ca78e11783759c118d492c0a82d2772687eb30 /pydis_site/apps/api/models
parentClean up SQL query (diff)
Constant was never used :man_facepalming:
Diffstat (limited to 'pydis_site/apps/api/models')
-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