analytics: Add `at_risk_count` to Totals row in realm summary.

This fixes reading from an unset value in realm_summary_table, which
is fine with the Django template engine but will be problematic with
jinja2.
This commit is contained in:
Umair Khan 2016-05-06 14:09:46 +05:00 committed by Tim Abbott
parent 4620cd8483
commit 6a0c7fec72
1 changed files with 4 additions and 1 deletions

View File

@ -243,10 +243,12 @@ def realm_summary_table(realm_minutes):
total_active_user_count = 0
total_user_profile_count = 0
total_bot_count = 0
total_at_risk_count = 0
for row in rows:
total_active_user_count += int(row['active_user_count'])
total_user_profile_count += int(row['user_profile_count'])
total_bot_count += int(row['bot_count'])
total_at_risk_count += int(row['at_risk_count'])
rows.append(dict(
@ -254,7 +256,8 @@ def realm_summary_table(realm_minutes):
active_user_count=total_active_user_count,
user_profile_count=total_user_profile_count,
bot_count=total_bot_count,
hours=int(total_hours)
hours=int(total_hours),
at_risk_count=total_at_risk_count,
))
content = loader.render_to_string(