python-discord / site

pythondiscord.com - A Django and Bulma web application.
https://pythondiscord.com
MIT License
639 stars 127 forks source link

Ensure messages returned for metricity data do not match all excluded channels #1240

Closed ChrisLovering closed 6 months ago

ChrisLovering commented 6 months ago

The logic here was wrong due to the != requiring us to use negative logic. This meant that messages in excluded channels were still being used for message count.

Tests with my user:

SELECT
    COUNT(*)
FROM messages
WHERE
    author_id = '126811506632294400'
    AND NOT is_deleted

>>> 111,045

SELECT
    COUNT(*)
FROM messages
WHERE
    author_id = '126811506632294400'
    AND NOT is_deleted
    AND channel_id != ANY('{267659945086812160,607247579608121354}')

>>> 111,045

SELECT
    COUNT(*)
FROM messages
WHERE
    author_id = '126811506632294400'
    AND NOT is_deleted
    AND channel_id != ALL('{267659945086812160,607247579608121354}')

>>> 110,402

netlify[bot] commented 6 months ago

Deploy Preview for pydis-static ready!

Name Link
Latest commit 3bec3c32dea8ebb939f7e65916905161d8ded30c
Latest deploy log https://app.netlify.com/sites/pydis-static/deploys/65d4c3988e6b2100083fa890
Deploy Preview https://deploy-preview-1240--pydis-static.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

coveralls commented 6 months ago

Coverage Status

coverage: 100.0%. remained the same when pulling 3bec3c32dea8ebb939f7e65916905161d8ded30c on fix-metricity-message-counts into f4d4fa7af2f99ef6215fe2a86d62e8cf8f9737c5 on main.