Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

activity: Don't show plan, ARR and discount when billing is disabled.

Vishnu KScfbea80f084b
diff --git a/analytics/views.py b/analytics/views.py
index 01db61ec778..4b2fbefd338 100644
--- a/analytics/views.py
+++ b/analytics/views.py
@@ -747,7 +747,6 @@ def realm_summary_table(realm_minutes: Dict[str, float]) -> str:
for row in rows:
row["date_created_day"] = row["date_created"].strftime("%Y-%m-%d")
- row["plan_type_string"] = get_plan_name(row["plan_type"])
row["age_days"] = int((now - row["date_created"]).total_seconds() / 86400)
row["is_new"] = row["age_days"] < 12 * 7
row["realm_owner_emails"] = ", ".join(realm_owners[row["string_id"]])
@@ -767,6 +766,8 @@ def realm_summary_table(realm_minutes: Dict[str, float]) -> str:
realms_to_default_discount = get_realms_to_default_discount_dict()
for row in rows:
+ row["plan_type_string"] = get_plan_name(row["plan_type"])
+
string_id = row["string_id"]
if string_id in estimated_arrs:
@@ -837,7 +838,12 @@ def realm_summary_table(realm_minutes: Dict[str, float]) -> str:
content = loader.render_to_string(
"analytics/realm_summary_table.html",
- dict(rows=rows, num_active_sites=num_active_sites, utctime=now.strftime("%Y-%m-%d %H:%MZ")),
+ dict(
+ rows=rows,
+ num_active_sites=num_active_sites,
+ utctime=now.strftime("%Y-%m-%d %H:%MZ"),
+ billing_enabled=settings.BILLING_ENABLED,
+ ),
)
return content
diff --git a/templates/analytics/realm_summary_table.html b/templates/analytics/realm_summary_table.html
index 300d444e8ce..02e19841a87 100644
--- a/templates/analytics/realm_summary_table.html
+++ b/templates/analytics/realm_summary_table.html
@@ -22,9 +22,11 @@
<tr>
<th>Realm</th>
<th>Created (green if ≤12wk)</th>
+ {% if billing_enabled %}
<th>Plan type</th>
<th>ARR</th>
<th>Effective rate (%)</th>
+ {% endif %}
<th></th>
<th>DAU</th>
<th>WAU</th>
@@ -51,6 +53,7 @@
{{ row.date_created_day }}
</td>
+ {% if billing_enabled %}
<td>
{{ row.plan_type_string }}
</td>
@@ -66,6 +69,7 @@
{{ row.effective_rate }}
{% endif %}
</td>
+ {% endif %}
<td>
{% if not loop.first %}