[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
Этот коммит содержится в:
@@ -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 {
|
||||
|
||||
Ссылка в новой задаче
Block a user