do_increment_logging_stat: Assert that .frequency is either DAY or HOUR.

An assert is appropriate here to ensure that some future additions of
other frequencies don't make this if/else logic wrong without explicitly
failing.
This commit is contained in:
Mateusz Mandera 2023-10-21 00:15:51 +02:00 committed by Tim Abbott
parent 7eb24ff237
commit 21c94953c8
1 changed files with 3 additions and 1 deletions

View File

@ -315,8 +315,10 @@ def do_increment_logging_stat(
if stat.frequency == CountStat.DAY:
end_time = ceiling_to_day(event_time)
else: # CountStat.HOUR:
elif stat.frequency == CountStat.HOUR:
end_time = ceiling_to_hour(event_time)
else:
raise AssertionError("Unsupported CountStat frequency")
row, created = table._default_manager.get_or_create(
property=stat.property,