analytics: Restrict fill_to_time to hour boundaries in process_count_stat.

This commit is contained in:
Rishi Gupta
2017-04-27 17:22:40 -07:00
committed by Tim Abbott
parent dfbeab73b5
commit 61bf445da4
2 changed files with 10 additions and 4 deletions

View File

@@ -87,6 +87,11 @@ def process_count_stat(stat, fill_to_time):
else:
raise AssertionError("Unknown frequency: %s" % (stat.frequency,))
if floor_to_hour(fill_to_time) != fill_to_time:
raise ValueError("fill_to_time must be on an hour boundary: %s" % (fill_to_time,))
if fill_to_time.tzinfo is None:
raise ValueError("fill_to_time must be timezone aware: %s" % (fill_to_time,))
fill_state = FillState.objects.filter(property=stat.property).first()
if fill_state is None:
currently_filled = installation_epoch()