Merge "Ensure the statistics are sorted"

This commit is contained in:
Jenkins 2013-03-13 01:25:59 +00:00 committed by Gerrit Code Review
commit 27aae2ee7a
2 changed files with 3 additions and 5 deletions

View File

@ -20,6 +20,7 @@
import copy import copy
import datetime import datetime
import operator
import re import re
import urlparse import urlparse
@ -519,7 +520,8 @@ class Connection(base.Connection):
query=q, query=q,
) )
return [r['value'] for r in results['results']] return sorted((r['value'] for r in results['results']),
key=operator.itemgetter('period_start'))
def get_volume_sum(self, event_filter): def get_volume_sum(self, event_filter):
"""Return the sum of the volume field for the events """Return the sum of the volume field for the events

View File

@ -804,9 +804,6 @@ class StatisticsTest(DBTestBase):
self.assertEqual(set(r['period_end'] for r in results), self.assertEqual(set(r['period_end'] for r in results),
set([datetime.datetime(2012, 9, 25, 12, 28), set([datetime.datetime(2012, 9, 25, 12, 28),
datetime.datetime(2012, 9, 25, 14, 28)])) datetime.datetime(2012, 9, 25, 14, 28)]))
'''
# FXIME(llu) Temporary comment out to pass Jenkins unittest.
# Will resume this after bug #1151345 is fixed.
r = results[0] r = results[0]
self.assertEqual(r['period_start'], self.assertEqual(r['period_start'],
datetime.datetime(2012, 9, 25, 10, 28)) datetime.datetime(2012, 9, 25, 10, 28))
@ -824,7 +821,6 @@ class StatisticsTest(DBTestBase):
datetime.datetime(2012, 9, 25, 10, 30)) datetime.datetime(2012, 9, 25, 10, 30))
self.assertEqual(r['duration_end'], self.assertEqual(r['duration_end'],
datetime.datetime(2012, 9, 25, 11, 31)) datetime.datetime(2012, 9, 25, 11, 31))
'''
def test_by_project(self): def test_by_project(self):
f = storage.EventFilter( f = storage.EventFilter(