MM-20305: Adds ability to choose whether deleted teams are included in the count query. (#13181)

Этот коммит содержится в:
Martin Kraft
2019-11-27 07:50:15 -05:00
коммит произвёл GitHub
родитель a1a2bb3130
Коммит 31ac88ef69
11 изменённых файлов: 47 добавлений и 20 удалений

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

@@ -84,7 +84,7 @@ func (a *App) GetAnalytics(name string, teamId string) (model.AnalyticsRows, *mo
teamCountChan := make(chan store.StoreResult, 1)
go func() {
teamCount, err := a.Srv.Store.Team().AnalyticsTeamCount()
teamCount, err := a.Srv.Store.Team().AnalyticsTeamCount(false)
teamCountChan <- store.StoreResult{Data: teamCount, Err: err}
close(teamCountChan)
}()

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

@@ -150,7 +150,7 @@ func (a *App) trackActivity() {
inactiveUserCount = iucr
}
teamCount, err := a.Srv.Store.Team().AnalyticsTeamCount()
teamCount, err := a.Srv.Store.Team().AnalyticsTeamCount(false)
if err != nil {
mlog.Error(err.Error())
}

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

@@ -499,7 +499,7 @@ func (me *TestHelper) ResetEmojisMigration() {
}
func (me *TestHelper) CheckTeamCount(t *testing.T, expected int64) {
teamCount, err := me.App.Srv.Store.Team().AnalyticsTeamCount()
teamCount, err := me.App.Srv.Store.Team().AnalyticsTeamCount(false)
require.Nil(t, err, "Failed to get team count.")
require.Equalf(t, teamCount, expected, "Unexpected number of teams. Expected: %v, found: %v", expected, teamCount)
}

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

@@ -505,7 +505,7 @@ func TestImportImportTeam(t *testing.T) {
scheme2 := th.SetupTeamScheme()
// Check how many teams are in the database.
teamsCount, err := th.App.Srv.Store.Team().AnalyticsTeamCount()
teamsCount, err := th.App.Srv.Store.Team().AnalyticsTeamCount(false)
require.Nil(t, err, "Failed to get team count.")
data := TeamImportData{

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

@@ -76,7 +76,7 @@ func (s *Server) DoSecurityUpdateCheck() {
v.Set(PROP_SECURITY_ACTIVE_USER_COUNT, strconv.FormatInt(ucr, 10))
}
if teamCount, err := s.Store.Team().AnalyticsTeamCount(); err == nil {
if teamCount, err := s.Store.Team().AnalyticsTeamCount(false); err == nil {
v.Set(PROP_SECURITY_TEAM_COUNT, strconv.FormatInt(teamCount, 10))
}

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

@@ -659,7 +659,7 @@ func (a *App) GetAllTeamsPage(offset int, limit int) ([]*model.Team, *model.AppE
}
func (a *App) GetAllTeamsPageWithCount(offset int, limit int) (*model.TeamsWithCount, *model.AppError) {
totalCount, err := a.Srv.Store.Team().AnalyticsTeamCount()
totalCount, err := a.Srv.Store.Team().AnalyticsTeamCount(true)
if err != nil {
return nil, err
}