Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Aubry <matt@piwik.org>2014-12-22 01:32:19 +0300
committerMatthieu Aubry <matt@piwik.org>2014-12-22 01:32:19 +0300
commit553bf991fca41c5f77b110645dd55e817aadb654 (patch)
treee6a13b7b69f93dd01d67c5c7272f12e94a23f463
parente9fdfd09efa8fca315bba07fd46d25e68854933f (diff)
parent227a99d79312d8a324c0ea3eeb0079420bc3489f (diff)
Merge pull request #6889 from piwik/58082.10.0-b10
Fix views and events that have the same timestamp get disordered
-rw-r--r--plugins/Live/Model.php5
-rw-r--r--plugins/Live/Visitor.php23
-rw-r--r--tests/PHPUnit/System/expected/test_ImportLogs__Live.getLastVisitsDetails_range.xml120
-rw-r--r--tests/PHPUnit/System/expected/test_periodIsRange_dateIsLastN_MetadataAndNormalAPI__Live.getLastVisits.xml36
-rw-r--r--tests/PHPUnit/System/expected/test_periodIsRange_dateIsLastN_MetadataAndNormalAPI__Live.getLastVisitsDetails_range.xml36
5 files changed, 118 insertions, 102 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;
}
}
diff --git a/tests/PHPUnit/System/expected/test_ImportLogs__Live.getLastVisitsDetails_range.xml b/tests/PHPUnit/System/expected/test_ImportLogs__Live.getLastVisitsDetails_range.xml
index 08e10d3b95..19fa0dba3c 100644
--- a/tests/PHPUnit/System/expected/test_ImportLogs__Live.getLastVisitsDetails_range.xml
+++ b/tests/PHPUnit/System/expected/test_ImportLogs__Live.getLastVisitsDetails_range.xml
@@ -1529,34 +1529,34 @@
<actionDetails>
<row>
- <type>goal</type>
- <goalName>all</goalName>
- <goalId>1</goalId>
- <revenue>5</revenue>
- <goalPageId>48</goalPageId>
-
- <url>http://piwik.net/blog/category/meta/</url>
- <icon>plugins/Morpheus/images/goal.png</icon>
- </row>
- <row>
<type>action</type>
<url>http://piwik.net/blog/category/meta/</url>
<pageTitle />
<pageIdAction>1</pageIdAction>
- <pageId>56</pageId>
+ <pageId>48</pageId>
<customVariables>
<row>
<customVariablePageName1>HTTP-code</customVariablePageName1>
<customVariablePageValue1>200</customVariablePageValue1>
</row>
</customVariables>
- <generationTime>0.02s</generationTime>
- <timeSpent>52</timeSpent>
- <timeSpentPretty>52s</timeSpentPretty>
+ <generationTime>0.12s</generationTime>
+ <timeSpent>0</timeSpent>
+ <timeSpentPretty>0s</timeSpentPretty>
<icon />
</row>
<row>
+ <type>goal</type>
+ <goalName>all</goalName>
+ <goalId>1</goalId>
+ <revenue>5</revenue>
+ <goalPageId>48</goalPageId>
+
+ <url>http://piwik.net/blog/category/meta/</url>
+ <icon>plugins/Morpheus/images/goal.png</icon>
+ </row>
+ <row>
<type>action</type>
<url>http://piwik.net/blog/category/meta/</url>
<pageTitle />
@@ -1580,16 +1580,16 @@
<pageTitle />
<pageIdAction>1</pageIdAction>
- <pageId>48</pageId>
+ <pageId>56</pageId>
<customVariables>
<row>
<customVariablePageName1>HTTP-code</customVariablePageName1>
<customVariablePageValue1>200</customVariablePageValue1>
</row>
</customVariables>
- <generationTime>0.12s</generationTime>
- <timeSpent>0</timeSpent>
- <timeSpentPretty>0s</timeSpentPretty>
+ <generationTime>0.02s</generationTime>
+ <timeSpent>52</timeSpent>
+ <timeSpentPretty>52s</timeSpentPretty>
<icon />
</row>
<row>
@@ -1598,16 +1598,16 @@
<pageTitle />
<pageIdAction>2</pageIdAction>
- <pageId>57</pageId>
+ <pageId>49</pageId>
<customVariables>
<row>
<customVariablePageName1>HTTP-code</customVariablePageName1>
<customVariablePageValue1>200</customVariablePageValue1>
</row>
</customVariables>
- <generationTime>0.24s</generationTime>
- <timeSpent>26</timeSpent>
- <timeSpentPretty>26s</timeSpentPretty>
+ <generationTime>0.23s</generationTime>
+ <timeSpent>52</timeSpent>
+ <timeSpentPretty>52s</timeSpentPretty>
<icon />
</row>
<row>
@@ -1616,14 +1616,14 @@
<pageTitle />
<pageIdAction>2</pageIdAction>
- <pageId>49</pageId>
+ <pageId>53</pageId>
<customVariables>
<row>
<customVariablePageName1>HTTP-code</customVariablePageName1>
<customVariablePageValue1>200</customVariablePageValue1>
</row>
</customVariables>
- <generationTime>0.23s</generationTime>
+ <generationTime>0.29s</generationTime>
<timeSpent>52</timeSpent>
<timeSpentPretty>52s</timeSpentPretty>
<icon />
@@ -1634,16 +1634,16 @@
<pageTitle />
<pageIdAction>2</pageIdAction>
- <pageId>53</pageId>
+ <pageId>57</pageId>
<customVariables>
<row>
<customVariablePageName1>HTTP-code</customVariablePageName1>
<customVariablePageValue1>200</customVariablePageValue1>
</row>
</customVariables>
- <generationTime>0.29s</generationTime>
- <timeSpent>52</timeSpent>
- <timeSpentPretty>52s</timeSpentPretty>
+ <generationTime>0.24s</generationTime>
+ <timeSpent>26</timeSpent>
+ <timeSpentPretty>26s</timeSpentPretty>
<icon />
</row>
<row>
@@ -1652,16 +1652,16 @@
<pageTitle />
<pageIdAction>3</pageIdAction>
- <pageId>54</pageId>
+ <pageId>50</pageId>
<customVariables>
<row>
<customVariablePageName1>HTTP-code</customVariablePageName1>
<customVariablePageValue1>200</customVariablePageValue1>
</row>
</customVariables>
- <generationTime>0.62s</generationTime>
- <timeSpent>7</timeSpent>
- <timeSpentPretty>7s</timeSpentPretty>
+ <generationTime>1.32s</generationTime>
+ <timeSpent>26</timeSpent>
+ <timeSpentPretty>26s</timeSpentPretty>
<icon />
</row>
<row>
@@ -1670,16 +1670,16 @@
<pageTitle />
<pageIdAction>3</pageIdAction>
- <pageId>50</pageId>
+ <pageId>54</pageId>
<customVariables>
<row>
<customVariablePageName1>HTTP-code</customVariablePageName1>
<customVariablePageValue1>200</customVariablePageValue1>
</row>
</customVariables>
- <generationTime>1.32s</generationTime>
- <timeSpent>26</timeSpent>
- <timeSpentPretty>26s</timeSpentPretty>
+ <generationTime>0.62s</generationTime>
+ <timeSpent>7</timeSpent>
+ <timeSpentPretty>7s</timeSpentPretty>
<icon />
</row>
<row>
@@ -1688,14 +1688,16 @@
<pageTitle />
<pageIdAction>4</pageIdAction>
- <pageId>55</pageId>
+ <pageId>51</pageId>
<customVariables>
<row>
<customVariablePageName1>HTTP-code</customVariablePageName1>
<customVariablePageValue1>200</customVariablePageValue1>
</row>
</customVariables>
- <generationTime>0.34s</generationTime>
+ <generationTime>0.54s</generationTime>
+ <timeSpent>7</timeSpent>
+ <timeSpentPretty>7s</timeSpentPretty>
<icon />
</row>
<row>
@@ -1704,16 +1706,14 @@
<pageTitle />
<pageIdAction>4</pageIdAction>
- <pageId>51</pageId>
+ <pageId>55</pageId>
<customVariables>
<row>
<customVariablePageName1>HTTP-code</customVariablePageName1>
<customVariablePageValue1>200</customVariablePageValue1>
</row>
</customVariables>
- <generationTime>0.54s</generationTime>
- <timeSpent>7</timeSpent>
- <timeSpentPretty>7s</timeSpentPretty>
+ <generationTime>0.34s</generationTime>
<icon />
</row>
</actionDetails>
@@ -2119,6 +2119,24 @@
<actionDetails>
<row>
+ <type>action</type>
+ <url>http://piwik.net/Products/theProduct</url>
+ <pageTitle />
+ <pageIdAction>55</pageIdAction>
+
+ <pageId>58</pageId>
+ <customVariables>
+ <row>
+ <customVariablePageName1>HTTP-code</customVariablePageName1>
+ <customVariablePageValue1>200</customVariablePageValue1>
+ </row>
+ </customVariables>
+ <generationTime>0.11s</generationTime>
+ <timeSpent>0</timeSpent>
+ <timeSpentPretty>0s</timeSpentPretty>
+ <icon />
+ </row>
+ <row>
<type>goal</type>
<goalName>all</goalName>
<goalId>1</goalId>
@@ -2143,24 +2161,6 @@
</customVariables>
<icon />
</row>
- <row>
- <type>action</type>
- <url>http://piwik.net/Products/theProduct</url>
- <pageTitle />
- <pageIdAction>55</pageIdAction>
-
- <pageId>58</pageId>
- <customVariables>
- <row>
- <customVariablePageName1>HTTP-code</customVariablePageName1>
- <customVariablePageValue1>200</customVariablePageValue1>
- </row>
- </customVariables>
- <generationTime>0.11s</generationTime>
- <timeSpent>0</timeSpent>
- <timeSpentPretty>0s</timeSpentPretty>
- <icon />
- </row>
</actionDetails>
<goalConversions>1</goalConversions>
<siteCurrency>USD</siteCurrency>
diff --git a/tests/PHPUnit/System/expected/test_periodIsRange_dateIsLastN_MetadataAndNormalAPI__Live.getLastVisits.xml b/tests/PHPUnit/System/expected/test_periodIsRange_dateIsLastN_MetadataAndNormalAPI__Live.getLastVisits.xml
index 373fee3685..87777d55db 100644
--- a/tests/PHPUnit/System/expected/test_periodIsRange_dateIsLastN_MetadataAndNormalAPI__Live.getLastVisits.xml
+++ b/tests/PHPUnit/System/expected/test_periodIsRange_dateIsLastN_MetadataAndNormalAPI__Live.getLastVisits.xml
@@ -256,45 +256,45 @@
<row>
<type>action</type>
<url>http://example.org/user/profile</url>
- <pageTitle>Profile page for user *_)%</pageTitle>
+ <pageTitle>Profile page</pageTitle>
<pageIdAction>4</pageIdAction>
- <pageId>3</pageId>
+ <pageId>2</pageId>
<customVariables>
<row>
- <customVariablePageName1>Language</customVariablePageName1>
- <customVariablePageValue1>FR</customVariablePageValue1>
- </row>
- <row>
- <customVariablePageName2>SET WITH EMPTY VALUE PAGE SCOPE</customVariablePageName2>
- <customVariablePageValue2 />
+ <customVariablePageName4>Status user</customVariablePageName4>
+ <customVariablePageValue4>Loggedin</customVariablePageValue4>
</row>
<row>
- <customVariablePageName4>Status user</customVariablePageName4>
- <customVariablePageValue4>looking at &quot;profile page&quot;</customVariablePageValue4>
+ <customVariablePageName5>Status user</customVariablePageName5>
+ <customVariablePageValue5>looking at &quot;profile page&quot;</customVariablePageValue5>
</row>
</customVariables>
+ <timeSpent>0</timeSpent>
+ <timeSpentPretty>0s</timeSpentPretty>
<icon />
</row>
<row>
<type>action</type>
<url>http://example.org/user/profile</url>
- <pageTitle>Profile page</pageTitle>
+ <pageTitle>Profile page for user *_)%</pageTitle>
<pageIdAction>4</pageIdAction>
- <pageId>2</pageId>
+ <pageId>3</pageId>
<customVariables>
<row>
- <customVariablePageName4>Status user</customVariablePageName4>
- <customVariablePageValue4>Loggedin</customVariablePageValue4>
+ <customVariablePageName1>Language</customVariablePageName1>
+ <customVariablePageValue1>FR</customVariablePageValue1>
</row>
<row>
- <customVariablePageName5>Status user</customVariablePageName5>
- <customVariablePageValue5>looking at &quot;profile page&quot;</customVariablePageValue5>
+ <customVariablePageName2>SET WITH EMPTY VALUE PAGE SCOPE</customVariablePageName2>
+ <customVariablePageValue2 />
+ </row>
+ <row>
+ <customVariablePageName4>Status user</customVariablePageName4>
+ <customVariablePageValue4>looking at &quot;profile page&quot;</customVariablePageValue4>
</row>
</customVariables>
- <timeSpent>0</timeSpent>
- <timeSpentPretty>0s</timeSpentPretty>
<icon />
</row>
</actionDetails>
diff --git a/tests/PHPUnit/System/expected/test_periodIsRange_dateIsLastN_MetadataAndNormalAPI__Live.getLastVisitsDetails_range.xml b/tests/PHPUnit/System/expected/test_periodIsRange_dateIsLastN_MetadataAndNormalAPI__Live.getLastVisitsDetails_range.xml
index 373fee3685..87777d55db 100644
--- a/tests/PHPUnit/System/expected/test_periodIsRange_dateIsLastN_MetadataAndNormalAPI__Live.getLastVisitsDetails_range.xml
+++ b/tests/PHPUnit/System/expected/test_periodIsRange_dateIsLastN_MetadataAndNormalAPI__Live.getLastVisitsDetails_range.xml
@@ -256,45 +256,45 @@
<row>
<type>action</type>
<url>http://example.org/user/profile</url>
- <pageTitle>Profile page for user *_)%</pageTitle>
+ <pageTitle>Profile page</pageTitle>
<pageIdAction>4</pageIdAction>
- <pageId>3</pageId>
+ <pageId>2</pageId>
<customVariables>
<row>
- <customVariablePageName1>Language</customVariablePageName1>
- <customVariablePageValue1>FR</customVariablePageValue1>
- </row>
- <row>
- <customVariablePageName2>SET WITH EMPTY VALUE PAGE SCOPE</customVariablePageName2>
- <customVariablePageValue2 />
+ <customVariablePageName4>Status user</customVariablePageName4>
+ <customVariablePageValue4>Loggedin</customVariablePageValue4>
</row>
<row>
- <customVariablePageName4>Status user</customVariablePageName4>
- <customVariablePageValue4>looking at &quot;profile page&quot;</customVariablePageValue4>
+ <customVariablePageName5>Status user</customVariablePageName5>
+ <customVariablePageValue5>looking at &quot;profile page&quot;</customVariablePageValue5>
</row>
</customVariables>
+ <timeSpent>0</timeSpent>
+ <timeSpentPretty>0s</timeSpentPretty>
<icon />
</row>
<row>
<type>action</type>
<url>http://example.org/user/profile</url>
- <pageTitle>Profile page</pageTitle>
+ <pageTitle>Profile page for user *_)%</pageTitle>
<pageIdAction>4</pageIdAction>
- <pageId>2</pageId>
+ <pageId>3</pageId>
<customVariables>
<row>
- <customVariablePageName4>Status user</customVariablePageName4>
- <customVariablePageValue4>Loggedin</customVariablePageValue4>
+ <customVariablePageName1>Language</customVariablePageName1>
+ <customVariablePageValue1>FR</customVariablePageValue1>
</row>
<row>
- <customVariablePageName5>Status user</customVariablePageName5>
- <customVariablePageValue5>looking at &quot;profile page&quot;</customVariablePageValue5>
+ <customVariablePageName2>SET WITH EMPTY VALUE PAGE SCOPE</customVariablePageName2>
+ <customVariablePageValue2 />
+ </row>
+ <row>
+ <customVariablePageName4>Status user</customVariablePageName4>
+ <customVariablePageValue4>looking at &quot;profile page&quot;</customVariablePageValue4>
</row>
</customVariables>
- <timeSpent>0</timeSpent>
- <timeSpentPretty>0s</timeSpentPretty>
<icon />
</row>
</actionDetails>