diff options
author | JoramWilander <jwawilander@gmail.com> | 2016-02-02 08:41:02 -0500 |
---|---|---|
committer | JoramWilander <jwawilander@gmail.com> | 2016-02-02 08:41:02 -0500 |
commit | 3d03bdf2f1af5385c2150544977fbba89650b1ee (patch) | |
tree | 77936a01b35e91bfb4126f5a9f4c5a4660130ae4 /store/sql_post_store.go | |
parent | f28486c4553f7f4bccf7bf69153c2f12699705f9 (diff) | |
download | chat-3d03bdf2f1af5385c2150544977fbba89650b1ee.tar.gz chat-3d03bdf2f1af5385c2150544977fbba89650b1ee.tar.bz2 chat-3d03bdf2f1af5385c2150544977fbba89650b1ee.zip |
Added extra system-wide statistics for EE
Diffstat (limited to 'store/sql_post_store.go')
-rw-r--r-- | store/sql_post_store.go | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/store/sql_post_store.go b/store/sql_post_store.go index aeaa5922c..c511dc370 100644 --- a/store/sql_post_store.go +++ b/store/sql_post_store.go @@ -940,7 +940,7 @@ func (s SqlPostStore) AnalyticsPostCountsByDay(teamId string) StoreChannel { return storeChannel } -func (s SqlPostStore) AnalyticsPostCount(teamId string) StoreChannel { +func (s SqlPostStore) AnalyticsPostCount(teamId string, mustHaveFile bool, mustHaveHashtag bool) StoreChannel { storeChannel := make(StoreChannel) go func() { @@ -959,8 +959,15 @@ func (s SqlPostStore) AnalyticsPostCount(teamId string) StoreChannel { query += " AND Channels.TeamId = :TeamId" } - v, err := s.GetReplica().SelectInt(query, map[string]interface{}{"TeamId": teamId}) - if err != nil { + if mustHaveFile { + query += " AND Posts.Filenames != '[]'" + } + + if mustHaveHashtag { + query += " AND Posts.Hashtags != ''" + } + + if v, err := s.GetReplica().SelectInt(query, map[string]interface{}{"TeamId": teamId}); err != nil { result.Err = model.NewLocAppError("SqlPostStore.AnalyticsPostCount", "store.sql_post.analytics_posts_count.app_error", nil, err.Error()) } else { result.Data = v |