diff --git a/mailpoet/assets/js/src/automation/integrations/mailpoet/analytics/components/tabs/emails/rows.tsx b/mailpoet/assets/js/src/automation/integrations/mailpoet/analytics/components/tabs/emails/rows.tsx
index 7098a79f3e..54546cc1b4 100644
--- a/mailpoet/assets/js/src/automation/integrations/mailpoet/analytics/components/tabs/emails/rows.tsx
+++ b/mailpoet/assets/js/src/automation/integrations/mailpoet/analytics/components/tabs/emails/rows.tsx
@@ -56,10 +56,7 @@ export function transformEmailsToRows(emails: EmailStats[]) {
return emails.map((email) => {
// Shows the percentage of clicked emails compared to the number of sent emails
- const clickedPercentage = calculatePercentage(
- email.clicked.current,
- email.sent.current,
- );
+ const clickedPercentage = calculatePercentage(email.clicked, email.sent);
const clickedBadge = percentageBadgeCalculation(clickedPercentage);
return [
@@ -82,56 +79,49 @@ export function transformEmailsToRows(emails: EmailStats[]) {
- {`${email.sent.current}`}
+ {`${email.sent}`}
}
subValue={
// Shows the percentage of sent emails compared to the previous email
percentageFormatter.format(
- calculatePercentage(
- email.sent.current,
- email.sent.previous,
- true,
- ) / 100,
+ calculatePercentage(email.sent, email.sent, true) / 100,
)
}
/>
),
- value: email.sent.current,
+ value: email.sent,
},
{
display: (
|
),
- value: email.opened.current,
+ value: email.opened,
},
{
display: (
0
+ email.sent > 0
? 'mailpoet-automation-analytics-email-clicked'
: ''
}
subValue={percentageFormatter.format(clickedPercentage / 100)}
- badge={email.sent.current > 0 ? clickedBadge.badge : undefined}
- badgeType={
- email.sent.current > 0 ? clickedBadge.badgeType : undefined
- }
+ badge={email.sent > 0 ? clickedBadge.badge : undefined}
+ badgeType={email.sent > 0 ? clickedBadge.badgeType : undefined}
/>
),
- value: email.clicked.current,
+ value: email.clicked,
},
{
display: (
@@ -145,21 +135,21 @@ export function transformEmailsToRows(emails: EmailStats[]) {
openOrders();
}}
>
- {`${email.orders.current}`}
+ {`${email.orders}`}
}
/>
),
- value: email.orders.current,
+ value: email.orders,
},
{
- display: | ,
- value: email.revenue.current,
+ display: | ,
+ value: email.revenue,
},
{
- display: | ,
- value: email.unsubscribed.current,
+ display: | ,
+ value: email.unsubscribed,
},
{
display: ,
diff --git a/mailpoet/assets/js/src/automation/integrations/mailpoet/analytics/components/tabs/emails/summary.tsx b/mailpoet/assets/js/src/automation/integrations/mailpoet/analytics/components/tabs/emails/summary.tsx
index a440d32468..626e8f469c 100644
--- a/mailpoet/assets/js/src/automation/integrations/mailpoet/analytics/components/tabs/emails/summary.tsx
+++ b/mailpoet/assets/js/src/automation/integrations/mailpoet/analytics/components/tabs/emails/summary.tsx
@@ -9,12 +9,12 @@ export function calculateSummary(rows: EmailStats[]) {
}
const data = rows.reduce(
(acc, row) => {
- acc.sent += row.sent.current;
- acc.opened += row.opened.current;
- acc.clicked += row.clicked.current;
- acc.orders += row.orders.current;
- acc.unsubscribed += row.unsubscribed.current;
- acc.revenue += row.revenue.current;
+ acc.sent += row.sent;
+ acc.opened += row.opened;
+ acc.clicked += row.clicked;
+ acc.orders += row.orders;
+ acc.unsubscribed += row.unsubscribed;
+ acc.revenue += row.revenue;
return acc;
},
{
diff --git a/mailpoet/assets/js/src/automation/integrations/mailpoet/analytics/store/types.ts b/mailpoet/assets/js/src/automation/integrations/mailpoet/analytics/store/types.ts
index 2039806885..571967013f 100644
--- a/mailpoet/assets/js/src/automation/integrations/mailpoet/analytics/store/types.ts
+++ b/mailpoet/assets/js/src/automation/integrations/mailpoet/analytics/store/types.ts
@@ -18,12 +18,12 @@ export type EmailStats = {
order: number;
name: string;
previewUrl: string;
- sent: CurrentAndPrevious;
- opened: CurrentAndPrevious;
- clicked: CurrentAndPrevious;
- orders: CurrentAndPrevious;
- revenue: CurrentAndPrevious;
- unsubscribed: CurrentAndPrevious;
+ sent: number;
+ opened: number;
+ clicked: number;
+ orders: number;
+ revenue: number;
+ unsubscribed: number;
};
type OverviewSectionData = SectionData & {
diff --git a/mailpoet/lib/Automation/Integrations/MailPoet/Analytics/Controller/OverviewStatisticsController.php b/mailpoet/lib/Automation/Integrations/MailPoet/Analytics/Controller/OverviewStatisticsController.php
index c24504a19f..81349c6ea0 100644
--- a/mailpoet/lib/Automation/Integrations/MailPoet/Analytics/Controller/OverviewStatisticsController.php
+++ b/mailpoet/lib/Automation/Integrations/MailPoet/Analytics/Controller/OverviewStatisticsController.php
@@ -71,12 +71,12 @@ class OverviewStatisticsController {
$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;
+ $data['emails'][$newsletterId]['sent'] = $statistic->getTotalSentCount();
+ $data['emails'][$newsletterId]['opened'] = $statistic->getOpenCount();
+ $data['emails'][$newsletterId]['clicked'] = $statistic->getClickCount();
+ $data['emails'][$newsletterId]['unsubscribed'] = $statistic->getUnsubscribeCount();
+ $data['emails'][$newsletterId]['orders'] = $statistic->getWooCommerceRevenue() ? $statistic->getWooCommerceRevenue()->getOrdersCount() : 0;
+ $data['emails'][$newsletterId]['revenue'] = $statistic->getWooCommerceRevenue() ? $statistic->getWooCommerceRevenue()->getValue() : 0;
$data['emails'][$newsletterId]['previewUrl'] = $newsletter ? $this->newsletterUrl->getViewInBrowserUrl($newsletter) : '';
$data['emails'][$newsletterId]['order'] = count($data['emails']);
}
@@ -95,12 +95,6 @@ class OverviewStatisticsController {
$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;
}
usort($data['emails'], function ($a, $b) {
|