summaryrefslogtreecommitdiffstats
path: root/store/sql_post_store.go
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2016-02-03 08:50:25 -0500
committerChristopher Speller <crspeller@gmail.com>2016-02-03 08:50:25 -0500
commitd479b08c997d3216938a3e92c3634a8b5afdb841 (patch)
tree59e23ddb3feea7f10c16b535892b9c44952e0779 /store/sql_post_store.go
parent0571953755bb96b3d1c15279e2fb429a3ec993a5 (diff)
parent9517690577111242f12f03eb27ee32d11e9d71a6 (diff)
downloadchat-d479b08c997d3216938a3e92c3634a8b5afdb841.tar.gz
chat-d479b08c997d3216938a3e92c3634a8b5afdb841.tar.bz2
chat-d479b08c997d3216938a3e92c3634a8b5afdb841.zip
Merge pull request #2045 from mattermost/plt-1849
PLT-1849 Added extra system-wide statistics for EE
Diffstat (limited to 'store/sql_post_store.go')
-rw-r--r--store/sql_post_store.go13
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