activity: Correct description of message-history figures.

This explains why the first number was usually the smallest!
This commit is contained in:
Greg Price 2017-11-30 21:04:15 -08:00
parent 799bf58463
commit d36b1cd2d7
2 changed files with 9 additions and 6 deletions

View File

@ -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 '<td class="number %s">%s</td>' % (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

View File

@ -24,7 +24,7 @@
<th>DAT/DAU (hr)</th>
<th>DAT (hr)</th>
<th></th>
<th colspan=8>Human messages sent, last 8 x 24hr (latest first)</th>
<th colspan=8>Human messages sent, last 8 UTC days (today-so-far first)</th>
</tr>
</thead>