feat: apply the reserved-or-confirmed send filter to the workspace sent-today count, the advisor mailbox volume windows, and the deliverability dashboard denominator so campaign wake-ups stop inflating sent totals

This commit is contained in:
Matthew Meszaros
2026-09-03 20:18:43 -07:00
parent ec9a3147b6
commit 3204cf41bd
3 changed files with 4 additions and 1 deletions
+2 -1
View File
@@ -664,7 +664,8 @@ func (r *advancedOutreachRepository) GetDeliverabilityDashboard(ctx context.Cont
SELECT COUNT(*) FROM tasks t
JOIN email_accounts ea ON ea.id = t.email_account_id
WHERE ea.organization_id = $1 AND t.task_type = 'campaign' AND t.status = 'completed'
AND t.completed_at >= $2 AND t.completed_at <= $3`
AND t.completed_at >= $2 AND t.completed_at <= $3
AND ` + taskDispatchedEmail
_ = r.db.QueryRow(ctx, sentQuery, organizationID, from, to).Scan(&out.EmailsSent)
out.BounceRate = models.Rate(out.BounceCount, out.EmailsSent)
out.ComplaintRate = models.Rate(out.ComplaintCount, out.EmailsSent)
@@ -70,6 +70,7 @@ func (r *advisorRepository) loadMailboxes(ctx context.Context, orgID uuid.UUID)
WHERE t.email_account_id = ea.id
AND t.task_type = 'campaign' AND t.status = 'completed'
AND t.completed_at > NOW() - INTERVAL '30 days'
AND ` + taskDispatchedEmail + `
) sent ON true
LEFT JOIN LATERAL (
SELECT
+1
View File
@@ -641,6 +641,7 @@ func (r *organizationRepository) GetEmailsSentTodayCount(ctx context.Context, or
AND t.task_type = 'campaign'
AND t.status = 'completed'
AND t.completed_at >= CURRENT_DATE
AND `+taskDispatchedEmail+`
`, orgID).Scan(&count)
return count, err
}