Make naming more consistent
[MAILPOET-3740]
This commit is contained in:
@@ -29,7 +29,7 @@ export const NewsletterGeneralStats = ({
|
|||||||
if (totalSent > 0) {
|
if (totalSent > 0) {
|
||||||
percentageClicked = (newsletter.statistics.clicked * 100) / totalSent;
|
percentageClicked = (newsletter.statistics.clicked * 100) / totalSent;
|
||||||
percentageOpened = (newsletter.statistics.opened * 100) / totalSent;
|
percentageOpened = (newsletter.statistics.opened * 100) / totalSent;
|
||||||
percentageMachineOpened = (newsletter.statistics.machineOpens * 100) / totalSent;
|
percentageMachineOpened = (newsletter.statistics.machineOpened * 100) / totalSent;
|
||||||
percentageUnsubscribed = (newsletter.statistics.unsubscribed * 100) / totalSent;
|
percentageUnsubscribed = (newsletter.statistics.unsubscribed * 100) / totalSent;
|
||||||
}
|
}
|
||||||
// format to 1 decimal place
|
// format to 1 decimal place
|
||||||
|
@@ -17,7 +17,7 @@ export type NewsletterType = {
|
|||||||
statistics: {
|
statistics: {
|
||||||
clicked: number;
|
clicked: number;
|
||||||
opened: number;
|
opened: number;
|
||||||
machineOpens: number;
|
machineOpened: number;
|
||||||
unsubscribed: number;
|
unsubscribed: number;
|
||||||
revenue: {
|
revenue: {
|
||||||
value: number;
|
value: number;
|
||||||
|
@@ -11,7 +11,7 @@ class NewsletterStatistics {
|
|||||||
private $openCount;
|
private $openCount;
|
||||||
|
|
||||||
/** @var int */
|
/** @var int */
|
||||||
private $machineOpens;
|
private $machineOpenCount;
|
||||||
|
|
||||||
/** @var int */
|
/** @var int */
|
||||||
private $unsubscribeCount;
|
private $unsubscribeCount;
|
||||||
@@ -50,19 +50,19 @@ class NewsletterStatistics {
|
|||||||
return $this->wooCommerceRevenue;
|
return $this->wooCommerceRevenue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setMachineOpens(int $machineOpens): void {
|
public function setMachineOpenCount(int $machineOpenCount): void {
|
||||||
$this->machineOpens = $machineOpens;
|
$this->machineOpenCount = $machineOpenCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getMachineOpens(): int {
|
public function getMachineOpenCount(): int {
|
||||||
return $this->machineOpens;
|
return $this->machineOpenCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function asArray(): array {
|
public function asArray(): array {
|
||||||
return [
|
return [
|
||||||
'clicked' => $this->clickCount,
|
'clicked' => $this->clickCount,
|
||||||
'opened' => $this->openCount,
|
'opened' => $this->openCount,
|
||||||
'machineOpens' => $this->machineOpens,
|
'machineOpened' => $this->machineOpenCount,
|
||||||
'unsubscribed' => $this->unsubscribeCount,
|
'unsubscribed' => $this->unsubscribeCount,
|
||||||
'revenue' => empty($this->wooCommerceRevenue) ? null : $this->wooCommerceRevenue->asArray(),
|
'revenue' => empty($this->wooCommerceRevenue) ? null : $this->wooCommerceRevenue->asArray(),
|
||||||
];
|
];
|
||||||
|
@@ -40,7 +40,7 @@ class NewsletterStatisticsRepository extends Repository {
|
|||||||
$this->getTotalSentCount($newsletter),
|
$this->getTotalSentCount($newsletter),
|
||||||
$this->getWooCommerceRevenue($newsletter)
|
$this->getWooCommerceRevenue($newsletter)
|
||||||
);
|
);
|
||||||
$stats->setMachineOpens($this->getStatisticsMachineOpenCount($newsletter));
|
$stats->setMachineOpenCount($this->getStatisticsMachineOpenCount($newsletter));
|
||||||
return $stats;
|
return $stats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -27,12 +27,12 @@ class NewslettersResponseBuilderTest extends \MailPoetTest {
|
|||||||
'opened' => 6,
|
'opened' => 6,
|
||||||
'clicked' => 4,
|
'clicked' => 4,
|
||||||
'unsubscribed' => 2,
|
'unsubscribed' => 2,
|
||||||
'machineOpens' => 9,
|
'machineOpened' => 9,
|
||||||
'revenue' => null,
|
'revenue' => null,
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
$statistics = new NewsletterStatistics(4, 6, 2, 10, null);
|
$statistics = new NewsletterStatistics(4, 6, 2, 10, null);
|
||||||
$statistics->setMachineOpens(9);
|
$statistics->setMachineOpenCount(9);
|
||||||
$newsletterStatsRepository = Stub::make(NewsletterStatisticsRepository::class, [
|
$newsletterStatsRepository = Stub::make(NewsletterStatisticsRepository::class, [
|
||||||
'getTotalSentCount' => $stats['total_sent'],
|
'getTotalSentCount' => $stats['total_sent'],
|
||||||
'getChildrenCount' => $stats['children_count'],
|
'getChildrenCount' => $stats['children_count'],
|
||||||
|
Reference in New Issue
Block a user