Fix import step 2 list selection box tallying unconfirmed subscribers (item B from #476)

Segments::getSegmentsForImport() was aliased to Segments::getSegmentsWithSubscriberCount()
This commit is contained in:
Alexey Stoletniy
2016-11-30 12:19:19 +03:00
parent f90ba712ee
commit b074b01b9f
2 changed files with 7 additions and 31 deletions

View File

@ -174,31 +174,7 @@ class Segment extends Model {
}
static function getSegmentsForImport() {
$query = self::selectMany(array(self::$_table.'.id', self::$_table.'.name'))
->selectExpr(
self::$_table.'.*, ' .
'COUNT(IF('.
MP_SUBSCRIBER_SEGMENT_TABLE.'.status="'.Subscriber::STATUS_SUBSCRIBED.'"'
.' AND '.
MP_SUBSCRIBERS_TABLE.'.deleted_at IS NULL'
.', 1, NULL)) `subscribers`'
)
->leftOuterJoin(
MP_SUBSCRIBER_SEGMENT_TABLE,
array(self::$_table.'.id', '=', MP_SUBSCRIBER_SEGMENT_TABLE.'.segment_id'))
->leftOuterJoin(
MP_SUBSCRIBERS_TABLE,
array(MP_SUBSCRIBER_SEGMENT_TABLE.'.subscriber_id', '=', MP_SUBSCRIBERS_TABLE.'.id'))
->groupBy(self::$_table.'.id')
->groupBy(self::$_table.'.name')
->orderByAsc(self::$_table.'.name')
->whereNull(self::$_table.'.deleted_at');
if(!empty($type)) {
$query->where(self::$_table.'.type', $type);
}
return $query->findArray();
return self::getSegmentsWithSubscriberCount($type = false);
}
static function getSegmentsForExport($withConfirmedSubscribers = false) {