GH-11385 Migrate User.AnalyticsGetInactiveUsersCount to Sync by default (#11432)

* GH-11385 Migrate User.AnalyticsGetInactiveUsersCount to Sync by default

* GH-11385 fix TestGetAnalyticsOld
This commit is contained in:
Marc Argent
2019-06-28 15:39:53 +01:00
committed by Christopher Speller
parent 46f2b18e4f
commit 3bce32bbcf
6 changed files with 38 additions and 31 deletions

View File

@@ -1417,14 +1417,12 @@ func (us SqlUserStore) performSearch(query sq.SelectBuilder, term string, option
return result
}
func (us SqlUserStore) AnalyticsGetInactiveUsersCount() store.StoreChannel {
return store.Do(func(result *store.StoreResult) {
if count, err := us.GetReplica().SelectInt("SELECT COUNT(Id) FROM Users WHERE DeleteAt > 0"); err != nil {
result.Err = model.NewAppError("SqlUserStore.AnalyticsGetInactiveUsersCount", "store.sql_user.analytics_get_inactive_users_count.app_error", nil, err.Error(), http.StatusInternalServerError)
} else {
result.Data = count
}
})
func (us SqlUserStore) AnalyticsGetInactiveUsersCount() (int64, *model.AppError) {
count, err := us.GetReplica().SelectInt("SELECT COUNT(Id) FROM Users WHERE DeleteAt > 0")
if err != nil {
return int64(0), model.NewAppError("SqlUserStore.AnalyticsGetInactiveUsersCount", "store.sql_user.analytics_get_inactive_users_count.app_error", nil, err.Error(), http.StatusInternalServerError)
}
return count, nil
}
func (us SqlUserStore) AnalyticsGetSystemAdminCount() store.StoreChannel {