Merge pull request #10 from reminder-bot/jellywx/fix-dm-reminders

group by channel instead of guild
This commit is contained in:
Jude Southworth 2022-09-03 15:44:00 +01:00 committed by GitHub
commit 6708abdb0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -292,22 +292,21 @@ INNER JOIN
ON
reminders.channel_id = channels.id
WHERE
reminders.id IN (
reminders.`id` IN (
SELECT
MIN(reminders.id)
FROM reminders
INNER JOIN
channels
ON reminders.channel_id = channels.id
WHERE reminders.`utc_time` < NOW()
GROUP BY channels.guild_id
)
AND reminders.`utc_time` < NOW()
MIN(id)
FROM
reminders
WHERE
reminders.`utc_time` <= NOW()
AND (
reminders.`interval_seconds` IS NOT NULL
OR reminders.`interval_months` IS NOT NULL
OR reminders.enabled
)"#,
)
GROUP BY channel_id
)
"#,
)
.fetch_all(pool)
.await