diff --git a/queries.sql b/queries.sql index f07bfad..75e9c4d 100644 --- a/queries.sql +++ b/queries.sql @@ -442,7 +442,7 @@ WITH camps AS ( SELECT campaigns.*, COALESCE(templates.body, (SELECT body FROM templates WHERE is_default = true LIMIT 1)) AS template_body FROM campaigns LEFT JOIN templates ON (templates.id = campaigns.template_id) - WHERE (status='running' OR (status='scheduled' AND campaigns.send_at >= NOW())) + WHERE (status='running' OR (status='scheduled' AND NOW() >= campaigns.send_at)) AND NOT(campaigns.id = ANY($1::INT[])) ), campLists AS (