- Displays statistics in newsletter listing

This commit is contained in:
Vlad
2016-04-26 11:50:40 -04:00
committed by Tautvidas Sipavičius
parent 67ca305b7f
commit 18f35b5e91
4 changed files with 53 additions and 11 deletions

View File

@ -94,15 +94,14 @@ class Newsletter extends Model {
}
function getStatistics() {
if (!property_exists($this, 'queue') || $this->queue === false) {
if ($this->queue === false) {
return false;
}
return SendingQueue::tableAlias('queues')
->selectExpr(
'count(DISTINCT(clicks.id)) as clicks, ' .
'count(DISTINCT(opens.id)) as opens, ' .
'count(DISTINCT(unsubscribes.id)) as unsubscribes',
'queues.count_processed as total_sent'
'count(DISTINCT(clicks.id)) as clicked, ' .
'count(DISTINCT(opens.id)) as opened, ' .
'count(DISTINCT(unsubscribes.id)) as unsubscribed '
)
->join(
MP_STATISTICS_CLICKS_TABLE,