From 5892e48ba4a92bfb014c5791de675ee43fbbd7a0 Mon Sep 17 00:00:00 2001 From: Lauryn Menard Date: Thu, 23 May 2024 16:06:02 +0200 Subject: [PATCH] analytics: Update "Messages sent by client" chart for Flutter app. Updates the labels in the "Messages sent by client" analytics chart for the user-agent/client names for the Flutter mobile app, which can be "ZulipFlutter" or "ZulipMobile/flutter". Fixes #28220. --- analytics/management/commands/populate_analytics_db.py | 3 +++ analytics/tests/test_stats_views.py | 7 +++++-- analytics/views/stats.py | 4 +++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/analytics/management/commands/populate_analytics_db.py b/analytics/management/commands/populate_analytics_db.py index a93af40ecb..f0fccf8f5e 100644 --- a/analytics/management/commands/populate_analytics_db.py +++ b/analytics/management/commands/populate_analytics_db.py @@ -285,6 +285,7 @@ class Command(ZulipBaseCommand): android, created = Client.objects.get_or_create(name="ZulipAndroid") iOS, created = Client.objects.get_or_create(name="ZulipiOS") react_native, created = Client.objects.get_or_create(name="ZulipMobile") + flutter, created = Client.objects.get_or_create(name="ZulipFlutter") API, created = Client.objects.get_or_create(name="API: Python") zephyr_mirror, created = Client.objects.get_or_create(name="zephyr_mirror") unused, created = Client.objects.get_or_create(name="unused") @@ -302,6 +303,7 @@ class Command(ZulipBaseCommand): android.id: self.generate_fixture_data(stat, 5, 5, 2, 0.6, 3), iOS.id: self.generate_fixture_data(stat, 5, 5, 2, 0.6, 3), react_native.id: self.generate_fixture_data(stat, 5, 5, 10, 0.6, 3), + flutter.id: self.generate_fixture_data(stat, 5, 5, 10, 0.6, 3), API.id: self.generate_fixture_data(stat, 5, 5, 5, 0.6, 3), zephyr_mirror.id: self.generate_fixture_data(stat, 1, 1, 3, 0.6, 3), unused.id: self.generate_fixture_data(stat, 0, 0, 0, 0, 0), @@ -313,6 +315,7 @@ class Command(ZulipBaseCommand): old_desktop.id: self.generate_fixture_data(stat, 50, 30, 8, 0.6, 3), android.id: self.generate_fixture_data(stat, 50, 50, 2, 0.6, 3), iOS.id: self.generate_fixture_data(stat, 50, 50, 2, 0.6, 3), + flutter.id: self.generate_fixture_data(stat, 5, 5, 10, 0.6, 3), react_native.id: self.generate_fixture_data(stat, 5, 5, 10, 0.6, 3), API.id: self.generate_fixture_data(stat, 50, 50, 5, 0.6, 3), zephyr_mirror.id: self.generate_fixture_data(stat, 10, 10, 3, 0.6, 3), diff --git a/analytics/tests/test_stats_views.py b/analytics/tests/test_stats_views.py index e4da601875..6846c295cd 100644 --- a/analytics/tests/test_stats_views.py +++ b/analytics/tests/test_stats_views.py @@ -661,7 +661,9 @@ class TestMapArrays(ZulipTestCase): "website": [1, 2, 3], "ZulipiOS": [1, 2, 3], "ZulipElectron": [2, 5, 7], - "ZulipMobile": [1, 5, 7], + "ZulipMobile": [1, 2, 3], + "ZulipMobile/flutter": [1, 1, 1], + "ZulipFlutter": [1, 1, 1], "ZulipPython": [1, 2, 3], "API: Python": [1, 2, 3], "SomethingRandom": [4, 5, 6], @@ -676,7 +678,8 @@ class TestMapArrays(ZulipTestCase): "Old desktop app": [32, 36, 39], "Old iOS app": [1, 2, 3], "Desktop app": [2, 5, 7], - "Mobile app": [1, 5, 7], + "Mobile app (React Native)": [1, 2, 3], + "Mobile app beta (Flutter)": [2, 2, 2], "Web app": [1, 2, 3], "Python API": [2, 4, 6], "SomethingRandom": [4, 5, 6], diff --git a/analytics/views/stats.py b/analytics/views/stats.py index 8b6db8fbde..1fe1fa72bd 100644 --- a/analytics/views/stats.py +++ b/analytics/views/stats.py @@ -525,7 +525,9 @@ def client_label_map(name: str) -> str: if name == "ZulipiOS": return "Old iOS app" if name == "ZulipMobile": - return "Mobile app" + return "Mobile app (React Native)" + if name in ["ZulipFlutter", "ZulipMobile/flutter"]: + return "Mobile app beta (Flutter)" if name in ["ZulipPython", "API: Python"]: return "Python API" if name.startswith("Zulip") and name.endswith("Webhook"):