Fix subscribers' segment filter
[MAILPOET-4563]
This commit is contained in:
@@ -260,9 +260,7 @@ class SubscriberListingRepository extends ListingRepository {
|
|||||||
$queryBuilder
|
$queryBuilder
|
||||||
->select('s')
|
->select('s')
|
||||||
->from(SegmentEntity::class, 's');
|
->from(SegmentEntity::class, 's');
|
||||||
if ($group === 'trash') {
|
if ($group !== 'trash') {
|
||||||
$queryBuilder->andWhere('s.deletedAt IS NOT NULL');
|
|
||||||
} else {
|
|
||||||
$queryBuilder->andWhere('s.deletedAt IS NULL');
|
$queryBuilder->andWhere('s.deletedAt IS NULL');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -285,9 +283,13 @@ class SubscriberListingRepository extends ListingRepository {
|
|||||||
} else {
|
} else {
|
||||||
$count = $this->subscribersCountsController->getSegmentStatisticsCount($segment);
|
$count = $this->subscribersCountsController->getSegmentStatisticsCount($segment);
|
||||||
}
|
}
|
||||||
|
$subscribersCount = (float)$count[$key];
|
||||||
|
// filter segments without subscribers
|
||||||
|
if (!$subscribersCount) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$segmentList[] = [
|
$segmentList[] = [
|
||||||
'label' => sprintf('%s (%s)', $segment->getName(), number_format((float)$count[$key])),
|
'label' => sprintf('%s (%s)', $segment->getName(), number_format($subscribersCount)),
|
||||||
'value' => $segment->getId(),
|
'value' => $segment->getId(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user