From d199c3768a8ad7075a790b51aa5142452a6d7a8e Mon Sep 17 00:00:00 2001 From: Oluwaseun Olorunsola Date: Thu, 10 Nov 2022 07:44:30 +0100 Subject: [PATCH] Show Bounced and Unsubscribed badge for minimum of 100 newsletter sent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The reason is that at low volumes the percentages can be misleading. E.g. if you send 20 emails and 1 hard bounces - that’s a hard bounce rate of 5%. The percentage is very high, but a single hard bounce doesn’t really mean anything, so to avoid confusion I’d hide the badge altogether for low volumes. MAILPOET-4688 --- .../campaign_stats/newsletter_general_stats.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mailpoet/assets/js/src/newsletters/campaign_stats/newsletter_general_stats.tsx b/mailpoet/assets/js/src/newsletters/campaign_stats/newsletter_general_stats.tsx index 69dd814c32..714e133bb2 100644 --- a/mailpoet/assets/js/src/newsletters/campaign_stats/newsletter_general_stats.tsx +++ b/mailpoet/assets/js/src/newsletters/campaign_stats/newsletter_general_stats.tsx @@ -19,6 +19,7 @@ const minNewslettersSent = 20; const minNewslettersOpened = 5; const minUnsubscribedStat = 5; const minBouncedStat = 5; +const minNewslettersSentForBouncedAndUnsubscribed = 100; // When percentage value is lower then 0.1 we want to display value with two decimal places const formatWithOptimalPrecision = (value: number) => { @@ -74,8 +75,11 @@ export function NewsletterGeneralStats({ newsletter.statistics.opened >= minNewslettersOpened; const displayUnsubscribedBadge = - newsletter.statistics.unsubscribed >= minUnsubscribedStat; - const displayBouncedBadge = newsletter.statistics.bounced >= minBouncedStat; + newsletter.statistics.unsubscribed >= minUnsubscribedStat && + totalSent >= minNewslettersSentForBouncedAndUnsubscribed; + const displayBouncedBadge = + newsletter.statistics.bounced >= minBouncedStat && + totalSent >= minNewslettersSentForBouncedAndUnsubscribed; const badgeTypeOpened = getBadgeType('opened', percentageOpened) || ''; const opened = (