From 91e2ecded14e6ad3d5b8b230e36b4733c3a201db Mon Sep 17 00:00:00 2001 From: David Remer Date: Mon, 25 Sep 2023 10:26:34 +0300 Subject: [PATCH] Report unique custom trigger and action hooks [MAILPOET-5212] --- mailpoet/lib/Analytics/Reporter.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mailpoet/lib/Analytics/Reporter.php b/mailpoet/lib/Analytics/Reporter.php index 427ebc968f..d557599c02 100644 --- a/mailpoet/lib/Analytics/Reporter.php +++ b/mailpoet/lib/Analytics/Reporter.php @@ -303,14 +303,14 @@ class Reporter { } $averageSteps = $activeAutomationCount > 0 ? $totalSteps / $activeAutomationCount : 0; - $customTriggerHooks = array_values(array_map( + $customTriggerHooks = array_unique(array_values(array_map( function(Automation $automation): string { $trigger = $automation->getTrigger('mailpoet:custom-trigger'); return $trigger ? (string)$trigger->getArgs()['hook'] : ''; }, $automationsWithCustomTrigger - )); - $customActionHooks = array_values(array_map( + ))); + $customActionHooks = array_unique(array_values(array_map( function(Automation $automation): array { $customActionSteps = array_filter( $automation->getSteps(), @@ -331,7 +331,7 @@ class Reporter { }, $activeAutomations - )); + ))); $customActionHooks = array_values(array_filter(array_merge(...$customActionHooks))); return [ 'Automation > Number of active automations' => $activeAutomationCount,