Fix counts in segment filter in subscriber listing

[MAILPOET-3132]
This commit is contained in:
Rostislav Wolny
2020-09-07 16:20:30 +02:00
committed by Veljko V
parent ea16dc7925
commit 65fd596f71
2 changed files with 3 additions and 5 deletions

View File

@ -154,15 +154,13 @@ class SubscriberListingRepository extends ListingRepository {
$queryBuilder
->select('sg.id, sg.name, COUNT(s) AS subscribersCount')
->leftJoin('s.subscriberSegments', 'ssg', Join::WITH, (string)$queryBuilderNoSegment->expr()->eq('ssg.status', ':statusSubscribed'))
->leftJoin('s.subscriberSegments', 'ssg')
->join('ssg.segment', 'sg')
->groupBy('sg.id')
->andWhere('sg.deletedAt IS NULL')
->andWhere('s.deletedAt IS NULL')
->andWhere('s.status = :statusSubscribed')
->orderBy('sg.name')
->having('subscribersCount > 0')
->setParameter('statusSubscribed', SubscriberEntity::STATUS_SUBSCRIBED);
->having('subscribersCount > 0');
// format segment list
$segmentList = [