From 905b84735d0070faa597933903499e4a93f99bd2 Mon Sep 17 00:00:00 2001 From: Thomas Steur Date: Fri, 19 Dec 2014 03:10:38 +0100 Subject: refs #5808 if there are many logs having the same server time, sort them by the autoincrement id --- plugins/Live/Model.php | 5 ++++- plugins/Live/Visitor.php | 23 ++++++++++++++++++----- 2 files changed, 22 insertions(+), 6 deletions(-) (limited to 'plugins/Live') 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; } } -- cgit v1.2.3