Stats: Stop counting the same user multiple times (#26777)

* Stats: Cache based stats implementation

* Stats: Correct logic and add larger scale test

* Stats: linter

* Stats: SQL implementation

* Stats: cleanup SQL

* Stats: Tab -> Spaces

* Update pkg/services/sqlstore/stats.go

Co-authored-by: Sofia Papagiannaki <papagian@users.noreply.github.com>

* Stats: Quote 'user' table with dialect.Quote

* Stats: Ensure test is run as integration test

* Stats: Use boolean value

...because if (v) { true } else { false } is unnecessary at best.

Co-authored-by: Sofia Papagiannaki <papagian@users.noreply.github.com>
This commit is contained in:
Emil Tullstedt
2020-08-24 11:23:14 +02:00
committed by GitHub
co-authored by Sofia Papagiannaki
parent 09a1af3f91
commit 954a2811b3
4 changed files with 244 additions and 91 deletions
+9 -7
View File
@@ -92,13 +92,15 @@ type GetSystemUserCountStatsQuery struct {
Result *SystemUserCountStats
}
type ActiveUserStats struct {
ActiveUsers int64
ActiveAdmins int64
ActiveEditors int64
ActiveViewers int64
type UserStats struct {
Users int64
Admins int64
Editors int64
Viewers int64
}
type GetActiveUserStatsQuery struct {
Result *ActiveUserStats
type GetUserStatsQuery struct {
MustUpdate bool
Active bool
Result UserStats
}