Fixed statistics page

This commit is contained in:
Eduard Urbach 2017-11-19 14:44:02 +01:00
parent d26a10a650
commit 004cdfc25c
2 changed files with 19 additions and 0 deletions

View File

@ -28,6 +28,9 @@ func getUserStats() []*arn.PieChart {
avatar := stats{}
ip := stats{}
pro := stats{}
connectionType := stats{}
roundTripTime := stats{}
downLink := stats{}
for info := range arn.StreamAnalytics() {
user, err := arn.GetUser(info.UserID)
@ -41,6 +44,18 @@ func getUserStats() []*arn.PieChart {
size := arn.ToString(info.Screen.Width) + " x " + arn.ToString(info.Screen.Height)
screenSize[size]++
if info.Connection.EffectiveType != "" {
connectionType[info.Connection.EffectiveType]++
}
if info.Connection.DownLink != 0 {
downLink[fmt.Sprintf("%.0f Mb/s", info.Connection.DownLink)]++
}
if info.Connection.RoundTripTime != 0 {
roundTripTime[fmt.Sprintf("%.0f ms", info.Connection.RoundTripTime)]++
}
}
for user := range arn.StreamUsers() {
@ -102,6 +117,9 @@ func getUserStats() []*arn.PieChart {
arn.NewPieChart("Notifications", notifications),
arn.NewPieChart("Gender", gender),
arn.NewPieChart("Pixel ratio", pixelRatio),
arn.NewPieChart("Connection", connectionType),
arn.NewPieChart("Ping", roundTripTime),
arn.NewPieChart("Download speed", downLink),
arn.NewPieChart("IP version", ip),
arn.NewPieChart("PRO accounts", pro),
}

View File

@ -4,6 +4,7 @@
text-align center
.widget
flex-basis 300px
max-width 300px
.pie-chart