diff --git a/analytics/views.py b/analytics/views.py index 1381e23d38..7ab77af9d6 100644 --- a/analytics/views.py +++ b/analytics/views.py @@ -8,7 +8,7 @@ from zerver.decorator import has_request_variables, REQ, zulip_internal from zerver.models import get_realm, UserActivity, UserActivityInterval from zerver.lib.timestamp import timestamp_to_datetime -import datetime +from datetime import datetime, timedelta import itertools import time import pytz @@ -191,10 +191,10 @@ def realm_summary_table(realm_minutes): def user_activity_intervals(): day_end = timestamp_to_datetime(time.time()) - day_start = day_end - datetime.timedelta(hours=24) + day_start = day_end - timedelta(hours=24) output = "Per-user online duration for the last 24 hours:\n" - total_duration = datetime.timedelta(0) + total_duration = timedelta(0) all_intervals = UserActivityInterval.objects.filter( end__gte=day_start, @@ -218,10 +218,10 @@ def user_activity_intervals(): realm_minutes = {} for domain, realm_intervals in itertools.groupby(all_intervals, by_domain): - realm_duration = datetime.timedelta(0) + realm_duration = timedelta(0) output += '