diff options
author | Stefan Giehl <stefan@matomo.org> | 2020-07-10 01:41:19 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-10 01:41:19 +0300 |
commit | d72b8bf705dabcdbd4d00876b2a3be9f58056e61 (patch) | |
tree | 818b198fbf5bd7e0a4207c7963bb30612c7f35c2 /plugins | |
parent | b0553730a95c5b6cd7408c5834ba8acd029c7375 (diff) |
Fix behaviour for segments using "not equals" or "not contains" on an action dimension (#16172)
Diffstat (limited to 'plugins')
m--------- | plugins/CustomVariables | 0 | ||||
-rw-r--r-- | plugins/Live/Model.php | 9 | ||||
-rw-r--r-- | plugins/SegmentEditor/SegmentEditor.php | 2 | ||||
-rw-r--r-- | plugins/Transitions/API.php | 2 |
4 files changed, 7 insertions, 6 deletions
diff --git a/plugins/CustomVariables b/plugins/CustomVariables -Subproject 9b96b7eff455fe63fd2247dbc6a18416905d0da +Subproject 49a252c85792d4d6f52acb1232004deb180790d diff --git a/plugins/Live/Model.php b/plugins/Live/Model.php index 9590cf00e3..023d716983 100644 --- a/plugins/Live/Model.php +++ b/plugins/Live/Model.php @@ -359,11 +359,12 @@ class Model $now = $now ?: time(); $bind = $idSites; - $bind[] = Date::factory($now - $lastMinutes * 60)->toString('Y-m-d H:i:s'); + $startDate = Date::factory($now - $lastMinutes * 60); + $bind[] = $startDate->toString('Y-m-d H:i:s'); $where = $whereIdSites . "AND " . $where; - $segment = new Segment($segment, $idSite); + $segment = new Segment($segment, $idSite, $startDate, $endDate = null); $query = $segment->getSelectQuery($select, $from, $where, $bind); $numVisitors = Db::getReader()->fetchOne($query['sql'], $query['bind']); @@ -428,7 +429,7 @@ class Model $orderBy = "MAX(log_visit.visit_last_action_time) $orderByDir"; $groupBy = "log_visit.idvisitor"; - $segment = new Segment($segment, $idSite); + $segment = new Segment($segment, $idSite, $dateOneDayAgo, $dateOneDayInFuture); $queryInfo = $segment->getSelectQuery($select, $from, $where, $whereBind, $orderBy, $groupBy); $sql = "SELECT sub.idvisitor, sub.visit_last_action_time FROM ({$queryInfo['sql']}) as sub @@ -466,7 +467,7 @@ class Model $filterSortOrder = 'DESC'; } - $segment = new Segment($segment, $idSite); + $segment = new Segment($segment, $idSite, $startDate, $endDate); // Subquery to use the indexes for ORDER BY $select = "log_visit.*"; diff --git a/plugins/SegmentEditor/SegmentEditor.php b/plugins/SegmentEditor/SegmentEditor.php index de89ca2c98..59ac72ee9c 100644 --- a/plugins/SegmentEditor/SegmentEditor.php +++ b/plugins/SegmentEditor/SegmentEditor.php @@ -201,12 +201,12 @@ class SegmentEditor extends \Piwik\Plugin if (empty($segment)) { return null; } - $segment = new Segment($segment, [$idSite]); // get period $date = Common::getRequestVar('date', false); $periodStr = Common::getRequestVar('period', false); $period = Period\Factory::build($periodStr, $date); + $segment = new Segment($segment, [$idSite], $period->getDateStart(), $period->getDateEnd()); // check if archiving is enabled. if so, the segment should have been processed. $isArchivingDisabled = Rules::isArchivingDisabledFor([$idSite], $segment, $period); diff --git a/plugins/Transitions/API.php b/plugins/Transitions/API.php index 39435541a2..a517e8653d 100644 --- a/plugins/Transitions/API.php +++ b/plugins/Transitions/API.php @@ -73,9 +73,9 @@ class API extends \Piwik\Plugin\API } // prepare log aggregator - $segment = new Segment($segment, $idSite); $site = new Site($idSite); $period = Period\Factory::build($period, $date); + $segment = new Segment($segment, $idSite, $period->getDateStart(), $period->getDateEnd()); $params = new ArchiveProcessor\Parameters($site, $period, $segment); $logAggregator = new LogAggregator($params); |