chg: [event:trendForTags] Filter out events having old modification compared to their publish_timestamp

pull/8625/head
Sami Mokaddem 2022-09-23 13:49:16 +02:00
parent dd1c3fb625
commit 05e53afb06
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
1 changed files with 4 additions and 0 deletions

View File

@ -7598,6 +7598,10 @@ class Event extends AppModel
public function getTrendsForTagsFromEvents(array $events, int $baseDayRange, int $rollingWindows=3, $tagFilterPrefixes=null): array
{
$oldestTimestamp = $this->resolveTimeDelta($baseDayRange + $baseDayRange * $rollingWindows . 'd');
$events = array_filter($events, function($event) use ($oldestTimestamp) { // Filter out events having old modification compared to their publish_timestamp
return $event['Event']['timestamp'] >= $oldestTimestamp;
});
App::uses('TrendingTool', 'Tools');
$trendingTool = new TrendingTool($this);
$trendAnalysis = $trendingTool->getTrendsForTags($events, $baseDayRange, $rollingWindows, $tagFilterPrefixes);