Fix counts in segment filter in subscriber listing
[MAILPOET-3132]
This commit is contained in:
committed by
Veljko V
parent
ea16dc7925
commit
65fd596f71
@ -154,15 +154,13 @@ class SubscriberListingRepository extends ListingRepository {
|
|||||||
|
|
||||||
$queryBuilder
|
$queryBuilder
|
||||||
->select('sg.id, sg.name, COUNT(s) AS subscribersCount')
|
->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')
|
->join('ssg.segment', 'sg')
|
||||||
->groupBy('sg.id')
|
->groupBy('sg.id')
|
||||||
->andWhere('sg.deletedAt IS NULL')
|
->andWhere('sg.deletedAt IS NULL')
|
||||||
->andWhere('s.deletedAt IS NULL')
|
->andWhere('s.deletedAt IS NULL')
|
||||||
->andWhere('s.status = :statusSubscribed')
|
|
||||||
->orderBy('sg.name')
|
->orderBy('sg.name')
|
||||||
->having('subscribersCount > 0')
|
->having('subscribersCount > 0');
|
||||||
->setParameter('statusSubscribed', SubscriberEntity::STATUS_SUBSCRIBED);
|
|
||||||
|
|
||||||
// format segment list
|
// format segment list
|
||||||
$segmentList = [
|
$segmentList = [
|
||||||
|
@ -59,7 +59,7 @@ class SubscriberListingRepositoryTest extends \MailPoetTest {
|
|||||||
expect($filters['segment'])->count(3);
|
expect($filters['segment'])->count(3);
|
||||||
expect($filters['segment'][0]['label'])->equals('All Lists');
|
expect($filters['segment'][0]['label'])->equals('All Lists');
|
||||||
expect($filters['segment'][1]['label'])->equals('Subscribers without a list (3)');
|
expect($filters['segment'][1]['label'])->equals('Subscribers without a list (3)');
|
||||||
expect($filters['segment'][2]['label'])->endsWith('(1)');
|
expect($filters['segment'][2]['label'])->endsWith('(2)');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testItBuildsGroups() {
|
public function testItBuildsGroups() {
|
||||||
|
Reference in New Issue
Block a user