[MM-14720] Add Posts Per Day Analytics and Number Posts Previous Day Functionality (#11402)
* Add ability to get bot counts per day Modify tests using AnalyticsPostCountsByDay to include extra input (botsOnly) Correctly generate the mock file with 'make store-mocks' target. Didn't see these comments earlier * Initial commit for calculating total posts previous day and total posts from bots previous day * - Refactor to use asserts instead of if statements in tests - Capture inputs to AnalyticsPostCountsByDay() function into an options struct - Remove bot creation from diagnostics_test.go. * Remove utils library * create AnalyticsPostCountsOptions struct which is accepted as an input to AnalyticsPostCountsByDay method * Go vet fixes
Этот коммит содержится в:
коммит произвёл
Christopher Speller
родитель
c8fb1b6265
Коммит
95652da0b8
@@ -181,13 +181,26 @@ func (a *App) GetAnalytics(name string, teamId string) (model.AnalyticsRows, *mo
|
||||
rows[9].Value = float64(r.Data.(int64))
|
||||
|
||||
return rows, nil
|
||||
} else if name == "bot_post_counts_day" {
|
||||
if skipIntensiveQueries {
|
||||
rows := model.AnalyticsRows{&model.AnalyticsRow{Name: "", Value: -1}}
|
||||
return rows, nil
|
||||
}
|
||||
return a.Srv.Store.Post().AnalyticsPostCountsByDay(&model.AnalyticsPostCountsOptions{
|
||||
TeamId: teamId,
|
||||
BotsOnly: true,
|
||||
YesterdayOnly: false,
|
||||
})
|
||||
} else if name == "post_counts_day" {
|
||||
if skipIntensiveQueries {
|
||||
rows := model.AnalyticsRows{&model.AnalyticsRow{Name: "", Value: -1}}
|
||||
return rows, nil
|
||||
}
|
||||
|
||||
return a.Srv.Store.Post().AnalyticsPostCountsByDay(teamId)
|
||||
return a.Srv.Store.Post().AnalyticsPostCountsByDay(&model.AnalyticsPostCountsOptions{
|
||||
TeamId: teamId,
|
||||
BotsOnly: false,
|
||||
YesterdayOnly: false,
|
||||
})
|
||||
} else if name == "user_counts_with_posts_day" {
|
||||
if skipIntensiveQueries {
|
||||
rows := model.AnalyticsRows{&model.AnalyticsRow{Name: "", Value: -1}}
|
||||
|
||||
Ссылка в новой задаче
Block a user