From 03a2a9c792464581bd56312747ed5cd1ee3a9e04 Mon Sep 17 00:00:00 2001 From: Shubham Dhama Date: Mon, 16 Apr 2018 16:06:02 +0530 Subject: [PATCH] activity: Add realm stats link to "realm activtiy table". --- analytics/views.py | 8 ++++++++ templates/analytics/realm_summary_table.html | 5 +++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/analytics/views.py b/analytics/views.py index abdc519ad7..a1f84e5bd1 100644 --- a/analytics/views.py +++ b/analytics/views.py @@ -468,6 +468,7 @@ def realm_summary_table(realm_minutes: Dict[str, float]) -> str: # formatting for row in rows: + row['stats_link'] = realm_stats_link(row['string_id']) row['string_id'] = realm_activity_link(row['string_id']) # Count active sites @@ -489,6 +490,7 @@ def realm_summary_table(realm_minutes: Dict[str, float]) -> str: rows.append(dict( string_id='Total', + stats_link = '', date_created_day='', realm_admin_email='', dau_count=total_dau_count, @@ -934,6 +936,12 @@ def realm_activity_link(realm_str: str) -> mark_safe: realm_link = '%s' % (url, realm_str) return mark_safe(realm_link) +def realm_stats_link(realm_str: str) -> mark_safe: + url_name = 'analytics.views.stats_for_realm' + url = reverse(url_name, kwargs=dict(realm_str=realm_str)) + stats_link = ''.format(url, realm_str) + return mark_safe(stats_link) + def realm_client_table(user_summaries: Dict[str, Dict[str, Dict[str, Any]]]) -> str: exclude_keys = [ 'internal', diff --git a/templates/analytics/realm_summary_table.html b/templates/analytics/realm_summary_table.html index a7ea67a954..b44930bac7 100644 --- a/templates/analytics/realm_summary_table.html +++ b/templates/analytics/realm_summary_table.html @@ -37,7 +37,7 @@ Realm Created (green if ≤12wk) - + DAU WAU Total users @@ -63,12 +63,13 @@ {{ row.date_created_day }} - + {% if not loop.last %} {% endif %} + {{ row.stats_link }}