From d36b1cd2d7c9d35dad98f6f2fe43ef4347a4a434 Mon Sep 17 00:00:00 2001 From: Greg Price Date: Thu, 30 Nov 2017 21:04:15 -0800 Subject: [PATCH] activity: Correct description of message-history figures. This explains why the first number was usually the smallest! --- analytics/views.py | 13 ++++++++----- templates/analytics/realm_summary_table.html | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/analytics/views.py b/analytics/views.py index a5f5e02a76..2126ae9e3f 100644 --- a/analytics/views.py +++ b/analytics/views.py @@ -265,11 +265,13 @@ def get_realm_day_counts() -> Dict[str, Dict[str, str]]: result = {} for string_id in counts: raw_cnts = [counts[string_id].get(age, 0) for age in range(8)] - min_cnt = min(raw_cnts) - max_cnt = max(raw_cnts) + min_cnt = min(raw_cnts[1:]) + max_cnt = max(raw_cnts[1:]) - def format_count(cnt: int) -> str: - if cnt == min_cnt: + def format_count(cnt: int, style: Optional[str]=None) -> str: + if style is not None: + good_bad = style + elif cnt == min_cnt: good_bad = 'bad' elif cnt == max_cnt: good_bad = 'good' @@ -278,7 +280,8 @@ def get_realm_day_counts() -> Dict[str, Dict[str, str]]: return '%s' % (good_bad, cnt) - cnts = ''.join(map(format_count, raw_cnts)) + cnts = (format_count(raw_cnts[0], 'neutral') + + ''.join(map(format_count, raw_cnts[1:]))) result[string_id] = dict(cnts=cnts) return result diff --git a/templates/analytics/realm_summary_table.html b/templates/analytics/realm_summary_table.html index 75cd81987e..3673a90e1b 100644 --- a/templates/analytics/realm_summary_table.html +++ b/templates/analytics/realm_summary_table.html @@ -24,7 +24,7 @@ DAT/DAU (hr) DAT (hr) - Human messages sent, last 8 x 24hr (latest first) + Human messages sent, last 8 UTC days (today-so-far first)