New statistics
This commit is contained in:
parent
68901ac25e
commit
7336fa2035
@ -43,6 +43,8 @@ func getUserStats() []*arn.PieChart {
|
||||
os := stats{}
|
||||
notifications := stats{}
|
||||
avatar := stats{}
|
||||
ip := stats{}
|
||||
pro := stats{}
|
||||
|
||||
for _, info := range analytics {
|
||||
user, err := arn.GetUser(info.UserID)
|
||||
@ -52,7 +54,7 @@ func getUserStats() []*arn.PieChart {
|
||||
continue
|
||||
}
|
||||
|
||||
pixelRatio[fmt.Sprintf("%.1f", info.Screen.PixelRatio)]++
|
||||
pixelRatio[fmt.Sprintf("%.0f", info.Screen.PixelRatio)]++
|
||||
|
||||
size := arn.ToString(info.Screen.Width) + " x " + arn.ToString(info.Screen.Height)
|
||||
screenSize[size]++
|
||||
@ -94,6 +96,18 @@ func getUserStats() []*arn.PieChart {
|
||||
} else {
|
||||
avatar[user.Avatar.Source]++
|
||||
}
|
||||
|
||||
if arn.IsIPv6(user.IP) {
|
||||
ip["IPv6"]++
|
||||
} else {
|
||||
ip["IPv4"]++
|
||||
}
|
||||
|
||||
if user.IsPro() {
|
||||
pro["PRO account"]++
|
||||
} else {
|
||||
pro["Free account"]++
|
||||
}
|
||||
}
|
||||
|
||||
println("Finished user statistics")
|
||||
@ -107,6 +121,8 @@ func getUserStats() []*arn.PieChart {
|
||||
arn.NewPieChart("Notifications", notifications),
|
||||
arn.NewPieChart("Gender", gender),
|
||||
arn.NewPieChart("Pixel ratio", pixelRatio),
|
||||
arn.NewPieChart("IP version", ip),
|
||||
arn.NewPieChart("PRO accounts", pro),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/aerogo/aero"
|
||||
"github.com/fatih/color"
|
||||
)
|
||||
|
||||
func TestRoutes(t *testing.T) {
|
||||
@ -24,7 +24,7 @@ func TestRoutes(t *testing.T) {
|
||||
app.Handler().ServeHTTP(responseRecorder, request)
|
||||
|
||||
if status := responseRecorder.Code; status != http.StatusOK {
|
||||
color.Red("%s | Wrong status code | %v instead of %v", example, status, http.StatusOK)
|
||||
panic(fmt.Errorf("%s | Wrong status code | %v instead of %v", example, status, http.StatusOK))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
16
tests.go
16
tests.go
@ -100,14 +100,6 @@ var routeTests = map[string][]string{
|
||||
"/api/animelist/4J6qpK1ve",
|
||||
},
|
||||
|
||||
"/api/animelist/:id/get/:item": []string{
|
||||
"/api/animelist/4J6qpK1ve/get/7929",
|
||||
},
|
||||
|
||||
"/api/animelist/:id/get/:item/:property": []string{
|
||||
"/api/animelist/4J6qpK1ve/get/7929/Episodes",
|
||||
},
|
||||
|
||||
"/api/settings/:id": []string{
|
||||
"/api/settings/4J6qpK1ve",
|
||||
},
|
||||
@ -144,14 +136,6 @@ var routeTests = map[string][]string{
|
||||
"/api/soundtrack/h0ac8sKkg",
|
||||
},
|
||||
|
||||
"/api/soundcloudtosoundtrack/:id": []string{
|
||||
"/api/soundcloudtosoundtrack/145918628",
|
||||
},
|
||||
|
||||
"/api/youtubetosoundtrack/:id": []string{
|
||||
"/api/youtubetosoundtrack/hU2wqJuOIp4",
|
||||
},
|
||||
|
||||
"/api/userfollows/:id": []string{
|
||||
"/api/userfollows/4J6qpK1ve",
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user