From e09a18db310f403eac632272351bcb6ef9282717 Mon Sep 17 00:00:00 2001 From: JoramWilander Date: Fri, 26 Feb 2016 11:27:45 -0500 Subject: Don't count expired sessions --- store/sql_session_store.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'store/sql_session_store.go') 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 -- cgit v1.2.3-1-g7c22