[MM-16871] Remove bots from "Daily Active Users" and "Monthly… (#11658)

* Add model.UserCountOptions to analyticsActiveCount method
Add new test for analyticsActiveCount method

* Add ability to delete entries from status store, by calling SQl
directly.  There is no method available to delete entries from the
status store interace

* Instead of cleaning up after a test by passing userIds, just delete all
records in the status table and start fresh

* Remove Comment
Этот коммит содержится в:
jfrerich
2019-07-19 13:30:59 -05:00
коммит произвёл GitHub
родитель b2706507e6
Коммит fdde7c8287
7 изменённых файлов: 98 добавлений и 20 удалений

Просмотреть файл

@@ -1105,11 +1105,17 @@ func (us SqlUserStore) Count(options model.UserCountOptions) (int64, *model.AppE
return count, nil
}
func (us SqlUserStore) AnalyticsActiveCount(timePeriod int64) (int64, *model.AppError) {
func (us SqlUserStore) AnalyticsActiveCount(timePeriod int64, options model.UserCountOptions) (int64, *model.AppError) {
time := model.GetMillis() - timePeriod
query := "SELECT COUNT(*) FROM Status WHERE LastActivityAt > :Time"
query := "SELECT COUNT(*) FROM Status s"
if options.IncludeBotAccounts {
query += " WHERE LastActivityAt > :Time"
} else {
query += " LEFT JOIN Bots ON s.UserId = Bots.UserId WHERE Bots.UserId IS NULL AND LastActivityAt > :Time"
}
v, err := us.GetReplica().SelectInt(query, map[string]interface{}{"Time": time})
if err != nil {