enable v2 api sqlalchemy tests

enable v2 api sqlalchemy tests
fix how mongo impl calculates period start time

Change-Id: I6149f6b77b5d82a93d1b3e92a2940f6bf953ad72
This commit is contained in:
Gordon Chung
2013-06-26 17:00:38 -04:00
parent ef17d89e08
commit 89fc448ed6
5 changed files with 45 additions and 46 deletions

View File

@@ -483,10 +483,14 @@ class Connection(base.Connection):
q = make_query_from_filter(sample_filter)
if period:
map_stats = self.MAP_STATS_PERIOD % \
(period,
int(sample_filter.start.strftime('%s'))
if sample_filter.start else 0)
if sample_filter.start:
period_start = sample_filter.start
else:
period_start = self.db.meter.find(
limit=1, sort=[('timestamp',
pymongo.ASCENDING)])[0]['timestamp']
period_start = int(period_start.strftime('%s'))
map_stats = self.MAP_STATS_PERIOD % (period, period_start)
else:
map_stats = self.MAP_STATS