mirror of https://github.com/zulip/zulip.git
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:
parent
7eb24ff237
commit
21c94953c8
|
@ -315,8 +315,10 @@ def do_increment_logging_stat(
|
||||||
|
|
||||||
if stat.frequency == CountStat.DAY:
|
if stat.frequency == CountStat.DAY:
|
||||||
end_time = ceiling_to_day(event_time)
|
end_time = ceiling_to_day(event_time)
|
||||||
else: # CountStat.HOUR:
|
elif stat.frequency == CountStat.HOUR:
|
||||||
end_time = ceiling_to_hour(event_time)
|
end_time = ceiling_to_hour(event_time)
|
||||||
|
else:
|
||||||
|
raise AssertionError("Unsupported CountStat frequency")
|
||||||
|
|
||||||
row, created = table._default_manager.get_or_create(
|
row, created = table._default_manager.get_or_create(
|
||||||
property=stat.property,
|
property=stat.property,
|
||||||
|
|
Loading…
Reference in New Issue