summaryrefslogtreecommitdiffstats
path: root/store/sql_user_store.go
diff options
context:
space:
mode:
authorCorey Hulen <corey@hulen.com>2015-10-12 14:22:05 -0700
committerCorey Hulen <corey@hulen.com>2015-10-12 14:22:05 -0700
commit191e248b0fbe833c0c52e1e6145f4d19b4c3a7b6 (patch)
tree63378d3100f0a70806767c87886b3e0b9037f8c5 /store/sql_user_store.go
parent246c7414bd2f22a3440af5df7d72f33e7207dc50 (diff)
parenta6a3c351a828441313e90c1ac8e6afbfadad1f7c (diff)
downloadchat-191e248b0fbe833c0c52e1e6145f4d19b4c3a7b6.tar.gz
chat-191e248b0fbe833c0c52e1e6145f4d19b4c3a7b6.tar.bz2
chat-191e248b0fbe833c0c52e1e6145f4d19b4c3a7b6.zip
Merge pull request #1022 from mattermost/release-1.1.0
Release 1.1.0rc merging to master
Diffstat (limited to 'store/sql_user_store.go')
-rw-r--r--store/sql_user_store.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/store/sql_user_store.go b/store/sql_user_store.go
index 011acd7e4..dc6b07a16 100644
--- a/store/sql_user_store.go
+++ b/store/sql_user_store.go
@@ -530,3 +530,24 @@ func (us SqlUserStore) GetTotalUsersCount() StoreChannel {
return storeChannel
}
+
+func (us SqlUserStore) GetTotalActiveUsersCount() StoreChannel {
+ storeChannel := make(StoreChannel)
+
+ go func() {
+ result := StoreResult{}
+
+ time := model.GetMillis() - (1000 * 60 * 60 * 12)
+
+ if count, err := us.GetReplica().SelectInt("SELECT COUNT(Id) FROM Users WHERE LastActivityAt > :Time", map[string]interface{}{"Time": time}); err != nil {
+ result.Err = model.NewAppError("SqlUserStore.GetTotalActiveUsersCount", "We could not count the users", err.Error())
+ } else {
+ result.Data = count
+ }
+
+ storeChannel <- result
+ close(storeChannel)
+ }()
+
+ return storeChannel
+}