summary refs log tree commit diff
diff options
context:
space:
mode:
authorNeil Johnson <neil@matrix.org>2018-05-21 16:42:18 +0000
committerGitHub <noreply@github.com>2018-05-21 16:42:18 +0000
commit4aac88928f4411b5056552f06934327e382d9b8c (patch)
tree2c49b4d694805030c890b34ba25c1bb1ef464c55
parentMerge pull request #3239 from ptman/develop (diff)
parentTighter filtering for user_daily_visits (diff)
downloadsynapse-4aac88928f4411b5056552f06934327e382d9b8c.tar.xz
Merge pull request #3251 from matrix-org/cohort_analytics
Tighter filtering for user_daily_visits
-rw-r--r--synapse/storage/__init__.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/synapse/storage/__init__.py b/synapse/storage/__init__.py
index ac264b5d25..979fa22438 100644
--- a/synapse/storage/__init__.py
+++ b/synapse/storage/__init__.py
@@ -379,7 +379,11 @@ class DataStore(RoomMemberStore, RoomStore,
                       WHERE timestamp = ?
                     ) udv
                     ON u.user_id = udv.user_id AND u.device_id=udv.device_id
-                    WHERE last_seen > ? AND last_seen <= ? AND udv.timestamp IS NULL
+                    INNER JOIN users ON users.name=u.user_id
+                    WHERE last_seen > ? AND last_seen <= ?
+                    AND udv.timestamp IS NULL AND users.is_guest=0
+                    AND users.appservice_id IS NULL
+                    GROUP BY u.user_id, u.device_id
             """
 
             # This means that the day has rolled over but there could still