mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 13:03:29 +00:00
analytics: Fix uses of 'interval' in arguments and variable names.
interval refers to a time interval, and frequency refers to something that semantically means something closer to 'hourly' or 'daily'. Currently, interval can have values 'hour', 'day', or 'gauge', and frequency can only have values 'hour' and 'day'.
This commit is contained in:
@@ -60,14 +60,14 @@ def get_messages_sent_to_realm(realm, min_length=None, start=None, end=None):
|
||||
if start > end:
|
||||
raise JsonableError(_("Start time is later than end time. Start: %(start)s, End: %(end)s") %
|
||||
{'start': start, 'end': end})
|
||||
interval = CountStat.DAY
|
||||
end_times = time_range(start, end, interval, min_length)
|
||||
frequency = CountStat.DAY
|
||||
end_times = time_range(start, end, frequency, min_length)
|
||||
indices = {}
|
||||
for i, end_time in enumerate(end_times):
|
||||
indices[end_time] = i
|
||||
|
||||
filter_set = RealmCount.objects.filter(
|
||||
realm=realm, property='messages_sent:is_bot', interval=interval) \
|
||||
realm=realm, property='messages_sent:is_bot', interval=frequency) \
|
||||
.values_list('end_time', 'value')
|
||||
humans = [0]*len(end_times)
|
||||
for end_time, value in filter_set.filter(subgroup=False):
|
||||
@@ -76,7 +76,8 @@ def get_messages_sent_to_realm(realm, min_length=None, start=None, end=None):
|
||||
for end_time, value in filter_set.filter(subgroup=True):
|
||||
bots[indices[end_time]] = value
|
||||
|
||||
return {'end_times': end_times, 'humans': humans, 'bots': bots, 'interval': interval}
|
||||
return {'end_times': end_times, 'humans': humans, 'bots': bots,
|
||||
'frequency': frequency, 'interval': frequency}
|
||||
|
||||
eastern_tz = pytz.timezone('US/Eastern')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user