Fix statistics

[MAILPOET-2503]
This commit is contained in:
Amine Ben hammou
2020-02-03 12:19:15 +01:00
committed by Jack Kitterhing
parent 0069380da6
commit 22b9103460
3 changed files with 29 additions and 5 deletions

View File

@ -59,18 +59,18 @@ class NewslettersResponseBuilder {
$data['options'] = $this->buildOptions($newsletter);
}
if ($relation === self::RELATION_TOTAL_SENT) {
$data['totalSent'] = $this->newslettersStatsRepository->getTotalSentCount($newsletter);
$data['total_sent'] = $this->newslettersStatsRepository->getTotalSentCount($newsletter);
}
if ($relation === self::RELATION_CHILDREN_COUNT) {
$data['childrenCount'] = $this->newslettersStatsRepository->getChildrenCount($newsletter);
$data['children_count'] = $this->newslettersStatsRepository->getChildrenCount($newsletter);
}
if ($relation === self::RELATION_SCHEDULED) {
$data['totalScheduled'] = (int)SendingQueue::findTaskByNewsletterId($newsletter->getId())
$data['total_scheduled'] = (int)SendingQueue::findTaskByNewsletterId($newsletter->getId())
->where('tasks.status', SendingQueue::STATUS_SCHEDULED)
->count();
}
if ($relation === self::RELATION_STATISTICS) {
$data['statistics'] = $this->newslettersStatsRepository->getStatistics($newsletter);
$data['statistics'] = $this->newslettersStatsRepository->getStatistics($newsletter)->asArray();
}
}
return $data;