summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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