Show Bounced and Unsubscribed badge for minimum of 100 newsletter sent

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
This commit is contained in:
Oluwaseun Olorunsola
2022-11-10 07:44:30 +01:00
committed by Aschepikov
parent 0e0c2447d9
commit d199c3768a

View File

@@ -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 = (