Add Email Tab
[MAILPOET-5092]
This commit is contained in:
@ -42,15 +42,17 @@ class OverviewStatisticsController {
|
||||
]
|
||||
);
|
||||
$data = [
|
||||
'total' => ['current' => 0, 'previous' => 0],
|
||||
'sent' => ['current' => 0, 'previous' => 0],
|
||||
'opened' => ['current' => 0, 'previous' => 0],
|
||||
'clicked' => ['current' => 0, 'previous' => 0],
|
||||
'orders' => ['current' => 0, 'previous' => 0],
|
||||
'unsubscribed' => ['current' => 0, 'previous' => 0],
|
||||
'revenue' => ['current' => 0, 'previous' => 0],
|
||||
'revenue_formatted' => [
|
||||
'current' => $formattedEmptyRevenue,
|
||||
'previous' => $formattedEmptyRevenue,
|
||||
],
|
||||
'emails' => [],
|
||||
];
|
||||
if (!$emails) {
|
||||
return $data;
|
||||
@ -69,12 +71,22 @@ class OverviewStatisticsController {
|
||||
$query->getPrimaryBefore(),
|
||||
$requiredData
|
||||
);
|
||||
foreach ($currentStatistics as $statistic) {
|
||||
$data['total']['current'] += $statistic->getTotalSentCount();
|
||||
foreach ($currentStatistics as $newsletterId => $statistic) {
|
||||
$data['sent']['current'] += $statistic->getTotalSentCount();
|
||||
$data['opened']['current'] += $statistic->getOpenCount();
|
||||
$data['clicked']['current'] += $statistic->getClickCount();
|
||||
$data['unsubscribed']['current'] += $statistic->getUnsubscribeCount();
|
||||
$data['orders']['current'] += $statistic->getWooCommerceRevenue() ? $statistic->getWooCommerceRevenue()->getOrdersCount() : 0;
|
||||
$data['revenue']['current'] += $statistic->getWooCommerceRevenue() ? $statistic->getWooCommerceRevenue()->getValue() : 0;
|
||||
$newsletter = $this->newslettersRepository->findOneById($newsletterId);
|
||||
$data['emails'][$newsletterId]['id'] = $newsletterId;
|
||||
$data['emails'][$newsletterId]['name'] = $newsletter ? $newsletter->getSubject() : '';
|
||||
$data['emails'][$newsletterId]['sent']['current'] = $statistic->getTotalSentCount();
|
||||
$data['emails'][$newsletterId]['opened']['current'] = $statistic->getOpenCount();
|
||||
$data['emails'][$newsletterId]['clicked']['current'] = $statistic->getClickCount();
|
||||
$data['emails'][$newsletterId]['unsubscribed']['current'] = $statistic->getUnsubscribeCount();
|
||||
$data['emails'][$newsletterId]['orders']['current'] = $statistic->getWooCommerceRevenue() ? $statistic->getWooCommerceRevenue()->getOrdersCount() : 0;
|
||||
$data['emails'][$newsletterId]['revenue']['current'] = $statistic->getWooCommerceRevenue() ? $statistic->getWooCommerceRevenue()->getValue() : 0;
|
||||
}
|
||||
|
||||
$previousStatistics = $this->newsletterStatisticsRepository->getBatchStatistics(
|
||||
@ -84,12 +96,19 @@ class OverviewStatisticsController {
|
||||
$requiredData
|
||||
);
|
||||
|
||||
foreach ($previousStatistics as $statistic) {
|
||||
$data['total']['previous'] += $statistic->getTotalSentCount();
|
||||
foreach ($previousStatistics as $newsletterId => $statistic) {
|
||||
$data['sent']['previous'] += $statistic->getTotalSentCount();
|
||||
$data['opened']['previous'] += $statistic->getOpenCount();
|
||||
$data['clicked']['previous'] += $statistic->getClickCount();
|
||||
$data['unsubscribed']['previous'] += $statistic->getUnsubscribeCount();
|
||||
$data['orders']['previous'] += $statistic->getWooCommerceRevenue() ? $statistic->getWooCommerceRevenue()->getOrdersCount() : 0;
|
||||
$data['revenue']['previous'] += $statistic->getWooCommerceRevenue() ? $statistic->getWooCommerceRevenue()->getValue() : 0;
|
||||
$data['emails'][$newsletterId]['sent']['previous'] = $statistic->getTotalSentCount();
|
||||
$data['emails'][$newsletterId]['opened']['previous'] = $statistic->getOpenCount();
|
||||
$data['emails'][$newsletterId]['clicked']['previous'] = $statistic->getClickCount();
|
||||
$data['emails'][$newsletterId]['unsubscribed']['previous'] = $statistic->getUnsubscribeCount();
|
||||
$data['emails'][$newsletterId]['orders']['previous'] = $statistic->getWooCommerceRevenue() ? $statistic->getWooCommerceRevenue()->getOrdersCount() : 0;
|
||||
$data['emails'][$newsletterId]['revenue']['previous'] = $statistic->getWooCommerceRevenue() ? $statistic->getWooCommerceRevenue()->getValue() : 0;
|
||||
}
|
||||
|
||||
$data['revenue_formatted']['current'] = $this->wooCommerceHelper->getRawPrice(
|
||||
|
Reference in New Issue
Block a user