diff options
author | Matthieu Aubry <matt@piwik.org> | 2014-12-22 01:32:19 +0300 |
---|---|---|
committer | Matthieu Aubry <matt@piwik.org> | 2014-12-22 01:32:19 +0300 |
commit | 553bf991fca41c5f77b110645dd55e817aadb654 (patch) | |
tree | e6a13b7b69f93dd01d67c5c7272f12e94a23f463 /plugins/Live | |
parent | e9fdfd09efa8fca315bba07fd46d25e68854933f (diff) | |
parent | 227a99d79312d8a324c0ea3eeb0079420bc3489f (diff) |
Merge pull request #6889 from piwik/58082.10.0-b10
Fix views and events that have the same timestamp get disordered
Diffstat (limited to 'plugins/Live')
-rw-r--r-- | plugins/Live/Model.php | 5 | ||||
-rw-r--r-- | plugins/Live/Visitor.php | 23 |
2 files changed, 22 insertions, 6 deletions
diff --git a/plugins/Live/Model.php b/plugins/Live/Model.php index 81215f864c..19a44ba1d6 100644 --- a/plugins/Live/Model.php +++ b/plugins/Live/Model.php @@ -48,6 +48,7 @@ class Model log_action.url_prefix, log_action_title.name AS pageTitle, log_action.idaction AS pageIdAction, + log_link_visit_action.idlink_va, log_link_visit_action.server_time as serverTimePretty, log_link_visit_action.time_spent_ref_action as timeSpentRef, log_link_visit_action.idlink_va AS pageId, @@ -86,6 +87,7 @@ class Model goal.name as goalName, goal.idgoal as goalId, goal.revenue as revenue, + log_conversion.idlink_va, log_conversion.idlink_va as goalPageId, log_conversion.server_time as serverTimePretty, log_conversion.url as url @@ -123,7 +125,8 @@ class Model " . LogAggregator::getSqlRevenue('revenue_shipping') . " as revenueShipping, " . LogAggregator::getSqlRevenue('revenue_discount') . " as revenueDiscount, items as items, - log_conversion.server_time as serverTimePretty + log_conversion.server_time as serverTimePretty, + log_conversion.idlink_va FROM " . Common::prefixTable('log_conversion') . " AS log_conversion WHERE idvisit = ? AND idgoal <= " . GoalManager::IDGOAL_ORDER . " diff --git a/plugins/Live/Visitor.php b/plugins/Live/Visitor.php index eec1ecb6ce..e1ab974efd 100644 --- a/plugins/Live/Visitor.php +++ b/plugins/Live/Visitor.php @@ -360,6 +360,10 @@ class Visitor implements VisitorInterface usort($actions, array('static', 'sortByServerTime')); + foreach ($actions as &$action) { + unset($action['idlink_va']); + } + $visitorDetailsArray['actionDetails'] = $actions; foreach ($visitorDetailsArray['actionDetails'] as &$details) { switch ($details['type']) { @@ -415,10 +419,19 @@ class Visitor implements VisitorInterface { $ta = strtotime($a['serverTimePretty']); $tb = strtotime($b['serverTimePretty']); - return $ta < $tb - ? -1 - : ($ta == $tb - ? 0 - : 1); + + if ($ta < $tb) { + return -1; + } + + if ($ta == $tb) { + if ($a['idlink_va'] > $b['idlink_va']) { + return 1; + } + + return -1; + } + + return 1; } } |