From 34ee019b20aba40bb3fc9e6f86a0d7340b555db6 Mon Sep 17 00:00:00 2001 From: Greg Price Date: Wed, 29 Nov 2017 16:38:17 -0800 Subject: [PATCH] activity: Consistently define "user" as non-deactivated, non-bot. --- analytics/views.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/analytics/views.py b/analytics/views.py index dbc94e21df..a5f5e02a76 100644 --- a/analytics/views.py +++ b/analytics/views.py @@ -316,6 +316,9 @@ def realm_summary_table(realm_minutes: Dict[str, float]) -> str: JOIN zerver_userprofile up ON up.id = ua.user_profile_id WHERE + up.is_active + AND (not up.is_bot) + AND query in ( '/json/send_message', 'send_message_backend', @@ -326,8 +329,6 @@ def realm_summary_table(realm_minutes: Dict[str, float]) -> str: ) AND last_visit > now() - interval '1 day' - AND - not is_bot GROUP BY realm_id ) user_counts ON user_counts.realm_id = realm.id @@ -368,6 +369,10 @@ def realm_summary_table(realm_minutes: Dict[str, float]) -> str: JOIN zerver_userprofile up ON up.id = ua.user_profile_id WHERE + up.realm_id = realm.id + AND up.is_active + AND (not up.is_bot) + AND query in ( '/json/send_message', '/api/v1/send_message', @@ -376,8 +381,6 @@ def realm_summary_table(realm_minutes: Dict[str, float]) -> str: '/json/users/me/pointer', 'update_pointer_backend' ) - AND - up.realm_id = realm.id AND last_visit > now() - interval '2 week' )