Simplify the query to calculate lifetime emails

Also rename email_counts to email_count and update tests

[MAILPOET-4177]
This commit is contained in:
Brezo Cordero
2022-03-30 14:17:24 -05:00
committed by Veljko V
parent 9e8aaec6c9
commit 8077322a29
7 changed files with 59 additions and 94 deletions

View File

@@ -113,7 +113,7 @@ class InactiveSubscribersController {
AND s.status = :status
AND s.id >= :startId
AND s.id < :endId
AND s.emails_count >= {$lifetimeEmailsThreshold}
AND s.email_count >= {$lifetimeEmailsThreshold}
GROUP BY s.id
HAVING count(s.id) >= :unopenedEmailsThreshold
",