diff options
| author | 2021-11-24 13:14:48 +0100 | |
|---|---|---|
| committer | 2021-11-24 13:14:48 +0100 | |
| commit | 18d2ea235eac24de453b552d669391eacae24c1c (patch) | |
| tree | fd5818998d1a82670448909bf8a83a806ad795b7 /pydis_site/apps | |
| parent | Merge pull request #627 from python-discord/don't-always-calc-activity-blocks (diff) | |
| parent | Alter message query to leverage index (diff) | |
Merge pull request #628 from python-discord/alter-query-to-leverage-index
Alter message query to leverage index
Diffstat (limited to 'pydis_site/apps')
| -rw-r--r-- | pydis_site/apps/api/models/bot/metricity.py | 14 | 
1 files changed, 7 insertions, 7 deletions
| diff --git a/pydis_site/apps/api/models/bot/metricity.py b/pydis_site/apps/api/models/bot/metricity.py index 33fb7ad7..901f191a 100644 --- a/pydis_site/apps/api/models/bot/metricity.py +++ b/pydis_site/apps/api/models/bot/metricity.py @@ -4,10 +4,10 @@ from django.db import connections  BLOCK_INTERVAL = 10 * 60  # 10 minute blocks -EXCLUDE_CHANNELS = [ +EXCLUDE_CHANNELS = (      "267659945086812160",  # Bot commands      "607247579608121354"  # SeasonalBot commands -] +)  class NotFoundError(Exception): @@ -46,12 +46,12 @@ class Metricity:          self.cursor.execute(              """              SELECT -              COUNT(*) +                COUNT(*)              FROM messages              WHERE -              author_id = '%s' -              AND NOT is_deleted -              AND NOT %s::varchar[] @> ARRAY[channel_id] +                author_id = '%s' +                AND NOT is_deleted +                AND channel_id NOT IN %s              """,              [user_id, EXCLUDE_CHANNELS]          ) @@ -79,7 +79,7 @@ class Metricity:                  WHERE                      author_id='%s'                      AND NOT is_deleted -                    AND NOT %s::varchar[] @> ARRAY[channel_id] +                    AND channel_id NOT IN %s                  GROUP BY interval              ) block_query;              """, | 
