Show only default segments in listings

[PREMIUM-38]
This commit is contained in:
Pavel Dohnal
2017-10-05 10:42:30 +01:00
parent fa9ef6e5bd
commit b7555aa640

View File

@ -152,6 +152,7 @@ class Segment extends Model {
static function getSegmentsWithSubscriberCount($type = self::TYPE_DEFAULT) {
$query = self::selectMany(array(self::$_table.'.id', self::$_table.'.name'))
->whereIn('type', array(Segment::TYPE_WP_USERS, Segment::TYPE_DEFAULT))
->selectExpr(
self::$_table.'.*, ' .
'COUNT(IF('.
@ -209,6 +210,13 @@ class Segment extends Model {
)->findArray();
}
static function listingQuery(array $data = array()) {
$query = self::select('*');
$query->whereIn('type', array(Segment::TYPE_WP_USERS, Segment::TYPE_DEFAULT));
return $query
->filter('groupBy', $data);
}
static function createOrUpdate($data = array()) {
$segment = false;