diff --git a/assets/js/src/segments/list.jsx b/assets/js/src/segments/list.jsx index 379ba6c3cc..7dbc6bc8a9 100644 --- a/assets/js/src/segments/list.jsx +++ b/assets/js/src/segments/list.jsx @@ -32,6 +32,10 @@ const columns = [ name: 'unsubscribed', label: MailPoet.I18n.t('unsubscribed'), }, + { + name: 'inactive', + label: MailPoet.I18n.t('inactive'), + }, { name: 'bounced', label: MailPoet.I18n.t('bounced'), @@ -212,6 +216,7 @@ class SegmentList extends React.Component { const subscribed = Number(segment.subscribers_count.subscribed || 0); const unconfirmed = Number(segment.subscribers_count.unconfirmed || 0); const unsubscribed = Number(segment.subscribers_count.unsubscribed || 0); + const inactive = Number(segment.subscribers_count.inactive || 0); const bounced = Number(segment.subscribers_count.bounced || 0); let segmentName; @@ -253,6 +258,9 @@ class SegmentList extends React.Component { { unsubscribed.toLocaleString() } + + { inactive.toLocaleString() } + { bounced.toLocaleString() } diff --git a/lib/Models/Segment.php b/lib/Models/Segment.php index da8b07d6d0..d6dd3dabe9 100644 --- a/lib/Models/Segment.php +++ b/lib/Models/Segment.php @@ -97,6 +97,11 @@ class Segment extends Model { OR relation.status = "' . Subscriber::STATUS_UNSUBSCRIBED . '" THEN 1 ELSE 0 END)', Subscriber::STATUS_UNSUBSCRIBED ) + ->select_expr( + 'SUM(CASE WHEN subscribers.status = "' . Subscriber::STATUS_INACTIVE . '" + OR relation.status = "' . Subscriber::STATUS_UNSUBSCRIBED . '" THEN 1 ELSE 0 END)', + Subscriber::STATUS_INACTIVE + ) ->select_expr( 'SUM(CASE WHEN subscribers.status = "' . Subscriber::STATUS_UNCONFIRMED . '" AND relation.status != "' . Subscriber::STATUS_UNSUBSCRIBED . '" THEN 1 ELSE 0 END)',