Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
remote-support: Fix last push notification sent field.
Lauryn Menard0c17b90fc503
diff --git a/corporate/lib/support.py b/corporate/lib/support.pyindex f9c7222446f..acd163e48a8 100644--- a/corporate/lib/support.py+++ b/corporate/lib/support.py@@ -79,7 +79,7 @@ class MobilePushData:total_mobile_users: intuncategorized_mobile_users: Optional[int] = Nonemobile_pushes_forwarded: Optional[int] = None- last_mobile_push_sent: Optional[datetime] = None+ last_mobile_push_sent: str = ""@dataclass@@ -259,17 +259,18 @@ def get_mobile_push_data(remote_entity: Union[RemoteZulipServer, RemoteRealm]) -property="mobile_pushes_forwarded::day",).last()if latest_remote_server_push_forwarded_count is not None: # nocoverage- return MobilePushData(- total_mobile_users=total_users,- uncategorized_mobile_users=uncategorized_users,- mobile_pushes_forwarded=mobile_pushes["total_forwarded"],- last_mobile_push_sent=latest_remote_server_push_forwarded_count.end_time,- )+ # mobile_pushes_forwarded is a CountStat with a day frequency,+ # so we want to show the start of the latest day interval.+ push_forwarded_interval_start = (+ latest_remote_server_push_forwarded_count.end_time - timedelta(days=1)+ ).strftime("%Y-%m-%d")+ else:+ push_forwarded_interval_start = "None"return MobilePushData(total_mobile_users=total_users,uncategorized_mobile_users=uncategorized_users,mobile_pushes_forwarded=mobile_pushes["total_forwarded"],- last_mobile_push_sent=None,+ last_mobile_push_sent=push_forwarded_interval_start,)else:assert isinstance(remote_entity, RemoteRealm)@@ -288,17 +289,18 @@ def get_mobile_push_data(remote_entity: Union[RemoteZulipServer, RemoteRealm]) -property="mobile_pushes_forwarded::day",).last()if latest_remote_realm_push_forwarded_count is not None: # nocoverage- return MobilePushData(- total_mobile_users=mobile_users,- uncategorized_mobile_users=None,- mobile_pushes_forwarded=mobile_pushes["total_forwarded"],- last_mobile_push_sent=latest_remote_realm_push_forwarded_count.end_time,- )+ # mobile_pushes_forwarded is a CountStat with a day frequency,+ # so we want to show the start of the latest day interval.+ push_forwarded_interval_start = (+ latest_remote_realm_push_forwarded_count.end_time - timedelta(days=1)+ ).strftime("%Y-%m-%d")+ else:+ push_forwarded_interval_start = "None"return MobilePushData(total_mobile_users=mobile_users,uncategorized_mobile_users=None,mobile_pushes_forwarded=mobile_pushes["total_forwarded"],- last_mobile_push_sent=None,+ last_mobile_push_sent=push_forwarded_interval_start,)diff --git a/templates/corporate/support/remote_realm_details.html b/templates/corporate/support/remote_realm_details.htmlindex 103c74bf2df..1957912443f 100644--- a/templates/corporate/support/remote_realm_details.html+++ b/templates/corporate/support/remote_realm_details.html@@ -25,7 +25,7 @@<br /><b>Mobile user count</b>: {{ support_data[remote_realm.id].mobile_push_data.total_mobile_users }}<br /><b>7-day mobile pushes count</b>: {{ support_data[remote_realm.id].mobile_push_data.mobile_pushes_forwarded }}<br />- <b>Last push notification sent (UTC)</b>: {{ format_optional_datetime(support_data[remote_realm.id].mobile_push_data.last_mobile_push_sent, True) }}<br />+ <b>Last push notification date</b>: {{ support_data[remote_realm.id].mobile_push_data.last_mobile_push_sent }}<br /></div>{% if remote_realm.plan_type != SPONSORED_PLAN_TYPE %}diff --git a/templates/corporate/support/remote_server_support.html b/templates/corporate/support/remote_server_support.htmlindex b6e0493c707..96dcd1873bc 100644--- a/templates/corporate/support/remote_server_support.html+++ b/templates/corporate/support/remote_server_support.html@@ -65,7 +65,7 @@<b>Uncategorized mobile user count:</b> {{ remote_servers_support_data[remote_server.id].mobile_push_data.uncategorized_mobile_users }}<br />{% endif %}<b>7-day mobile pushes count</b>: {{ remote_servers_support_data[remote_server.id].mobile_push_data.mobile_pushes_forwarded }}<br />- <b>Last push notification sent (UTC)</b>: {{ format_optional_datetime(remote_servers_support_data[remote_server.id].mobile_push_data.last_mobile_push_sent, True) }}<br />+ <b>Last push notification date</b>: {{ remote_servers_support_data[remote_server.id].mobile_push_data.last_mobile_push_sent }}<br /></div>{% if remote_server.plan_type != SPONSORED_PLAN_TYPE %}