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