Fixed stats for welcome emails
- re-added ORM logging in order to debug queries - fixed subscription confirmation / unsubscribe due to API refactor
This commit is contained in:
@ -10,6 +10,7 @@ class Subscription {
|
||||
|
||||
static function confirm($data) {
|
||||
$subscription = new UserSubscription\Pages('confirm', $data);
|
||||
$subscription->confirm();
|
||||
}
|
||||
|
||||
static function manage($data) {
|
||||
@ -18,5 +19,6 @@ class Subscription {
|
||||
|
||||
static function unsubscribe($data) {
|
||||
$subscription = new UserSubscription\Pages('unsubscribe', $data);
|
||||
$subscription->unsubscribe();
|
||||
}
|
||||
}
|
@ -56,6 +56,7 @@ class Initializer {
|
||||
\ORM::configure(Env::$db_source_name);
|
||||
\ORM::configure('username', Env::$db_username);
|
||||
\ORM::configure('password', Env::$db_password);
|
||||
\ORM::configure('logging', WP_DEBUG);
|
||||
\ORM::configure('driver_options', array(
|
||||
\PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
|
||||
\PDO::MYSQL_ATTR_INIT_COMMAND =>
|
||||
|
@ -189,11 +189,39 @@ class Newsletter extends Model {
|
||||
} else {
|
||||
$this->statistics = $statistics->asArray();
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
function getStatistics() {
|
||||
switch($this->type) {
|
||||
case self::TYPE_WELCOME:
|
||||
return SendingQueue::tableAlias('queues')
|
||||
->selectExpr(
|
||||
'COUNT(DISTINCT(clicks.subscriber_id)) as clicked, ' .
|
||||
'COUNT(DISTINCT(opens.subscriber_id)) as opened, ' .
|
||||
'COUNT(DISTINCT(unsubscribes.subscriber_id)) as unsubscribed '
|
||||
)
|
||||
->leftOuterJoin(
|
||||
MP_STATISTICS_CLICKS_TABLE,
|
||||
'queues.id = clicks.queue_id',
|
||||
'clicks'
|
||||
)
|
||||
->leftOuterJoin(
|
||||
MP_STATISTICS_OPENS_TABLE,
|
||||
'queues.id = opens.queue_id',
|
||||
'opens'
|
||||
)
|
||||
->leftOuterJoin(
|
||||
MP_STATISTICS_UNSUBSCRIBES_TABLE,
|
||||
'queues.id = unsubscribes.queue_id',
|
||||
'unsubscribes'
|
||||
)
|
||||
->where('queues.newsletter_id', $this->id)
|
||||
->where('queues.status', SendingQueue::STATUS_COMPLETED)
|
||||
->findOne();
|
||||
break;
|
||||
|
||||
default:
|
||||
if($this->queue === false) {
|
||||
return false;
|
||||
}
|
||||
@ -221,6 +249,7 @@ class Newsletter extends Model {
|
||||
->where('queues.id', $this->queue['id'])
|
||||
->findOne();
|
||||
}
|
||||
}
|
||||
|
||||
static function search($orm, $search = '') {
|
||||
if(strlen(trim($search)) > 0) {
|
||||
|
Reference in New Issue
Block a user