Opened 3 years ago

Closed 3 years ago

#2154 closed Bug (fixed)

IndexedByDate.getDataTableFromNumeric() lack of 'order by' breaks integration tests

Reported by: JulienM Owned by:
Priority: normal Milestone: Piwik 1.2.1
Component: Core Keywords:
Cc: Sensitive: no

Description

I have a failing integration test concerning test_TwoVisitors_twoWebsites_differentDays__VisitFrequency.get_day.xml

Expected is

			<nb_uniq_visitors_returning>1</nb_uniq_visitors_returning>
			<nb_visits_returning>1</nb_visits_returning>
			<nb_actions_returning>4</nb_actions_returning>
			<max_actions_returning>4</max_actions_returning>
			<sum_visit_length_returning>900</sum_visit_length_returning>
			<bounce_rate_returning>0%</bounce_rate_returning>
			<nb_actions_per_visit_returning>4</nb_actions_per_visit_returning>
			<avg_time_on_site_returning>900</avg_time_on_site_returning>

I have

			<max_actions_returning>4</max_actions_returning>
			<nb_actions_returning>4</nb_actions_returning>
			<nb_uniq_visitors_returning>1</nb_uniq_visitors_returning>
			<nb_visits_returning>1</nb_visits_returning>
			<sum_visit_length_returning>900</sum_visit_length_returning>
			<bounce_rate_returning>0%</bounce_rate_returning>
			<nb_actions_per_visit_returning>4</nb_actions_per_visit_returning>
			<avg_time_on_site_returning>900</avg_time_on_site_returning>

Markups are not in the same order.

There is no 'order by' clause at http://dev.piwik.org/trac/browser/trunk/core/Archive/Array/IndexedByDate.php#L108 so it's not clear which order should be tested.

Same is true for test_TwoVisitors_twoWebsites_differentDays__VisitsSummary.get_day.xml.

Change History (2)

comment:1 Changed 3 years ago by vipsoft (robocoder)

  • Milestone set to 1.3 - Piwik 1.3

There's a ksort on timestamps on line 136. I suppose we can either:

  • at line 141, insert a ksort($contentArray($timestamp)) inside the foreach loop, or
  • remove the ksort and add an "ORDER BY date1,name".

Not sure how much peak memory usage it'll reduce, but I'd go with the latter.

comment:2 Changed 3 years ago by JulienM (JulienMoumne)

  • Resolution set to fixed
  • Status changed from new to closed

(In [4051]) fixes #2154 - ordering getDataTableFromNumeric query by date and name & updating expected output

Note: See TracTickets for help on using tickets.