Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
remote-activity: Format no mobile push data as zero for remote server.
Lauryn Menard2e7715e52248
diff --git a/analytics/views/activity_common.py b/analytics/views/activity_common.pyindex 441e33589c0..eb5460cd2ac 100644--- a/analytics/views/activity_common.py+++ b/analytics/views/activity_common.py@@ -51,7 +51,7 @@ def make_table(def fix_rows(rows: List[List[Any]],i: int,- fixup_func: Union[Callable[[str], Markup], Callable[[datetime], str]],+ fixup_func: Union[Callable[[str], Markup], Callable[[datetime], str], Callable[[int], int]],) -> None:for row in rows:row[i] = fixup_func(row[i])@@ -79,6 +79,13 @@ def format_date_for_activity_reports(date: Optional[datetime]) -> str:return ""+def format_none_as_zero(value: Optional[int]) -> int:+ if value:+ return value+ else:+ return 0++def user_activity_link(email: str, user_profile_id: int) -> Markup:from analytics.views.user_activity import get_user_activitydiff --git a/analytics/views/remote_activity.py b/analytics/views/remote_activity.pyindex 1753fec5968..17fa8e6e74b 100644--- a/analytics/views/remote_activity.py+++ b/analytics/views/remote_activity.py@@ -5,6 +5,7 @@ from psycopg2.sql import SQLfrom analytics.views.activity_common import (fix_rows,format_date_for_activity_reports,+ format_none_as_zero,get_query_data,make_table,remote_installation_stats_link,@@ -122,6 +123,8 @@ def get_remote_server_activity(request: HttpRequest) -> HttpResponse:for i, col in enumerate(cols):if col == "Last update time":fix_rows(rows, i, format_date_for_activity_reports)+ if col in ["Mobile users", "Mobile pushes forwarded"]:+ fix_rows(rows, i, format_none_as_zero)if i == 0:total_row.append("Total")elif i in totals_columns: