summaryrefslogtreecommitdiffstats
path: root/store
diff options
context:
space:
mode:
authorJoramWilander <jwawilander@gmail.com>2016-02-26 11:27:45 -0500
committerJoramWilander <jwawilander@gmail.com>2016-03-01 10:46:30 -0500
commite09a18db310f403eac632272351bcb6ef9282717 (patch)
tree686c1d961a99f7dadf497c9994ed66ceb17997b2 /store
parent8239c68cf323e4bb20007d2b456336becead273d (diff)
downloadchat-e09a18db310f403eac632272351bcb6ef9282717.tar.gz
chat-e09a18db310f403eac632272351bcb6ef9282717.tar.bz2
chat-e09a18db310f403eac632272351bcb6ef9282717.zip
Don't count expired sessions
Diffstat (limited to 'store')
-rw-r--r--store/sql_session_store.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/store/sql_session_store.go b/store/sql_session_store.go
index 6fe71db17..337ad16e6 100644
--- a/store/sql_session_store.go
+++ b/store/sql_session_store.go
@@ -266,13 +266,14 @@ func (me SqlSessionStore) AnalyticsSessionCount(teamId string) StoreChannel {
`SELECT
COUNT(*)
FROM
- Sessions`
+ Sessions
+ WHERE ExpiresAt > :Time`
if len(teamId) > 0 {
- query += " WHERE TeamId = :TeamId"
+ query += " AND TeamId = :TeamId"
}
- if c, err := me.GetReplica().SelectInt(query, map[string]interface{}{"TeamId": teamId}); err != nil {
+ if c, err := me.GetReplica().SelectInt(query, map[string]interface{}{"Time": model.GetMillis(), "TeamId": teamId}); err != nil {
result.Err = model.NewLocAppError("SqlSessionStore.AnalyticsSessionCount", "store.sql_session.analytics_session_count.app_error", nil, err.Error())
} else {
result.Data = c