New statistics
This commit is contained in:
parent
fc2130b2df
commit
b75ec453f5
@ -21,8 +21,31 @@ func Anime(ctx *aero.Context) string {
|
||||
anilist := stats{}
|
||||
status := stats{}
|
||||
types := stats{}
|
||||
shoboiEdits := stats{}
|
||||
anilistEdits := stats{}
|
||||
rating := stats{}
|
||||
|
||||
for _, anime := range allAnime {
|
||||
for _, external := range anime.Mappings {
|
||||
if external.Service == "shoboi/anime" {
|
||||
if external.CreatedBy == "" {
|
||||
shoboiEdits["Bot"]++
|
||||
} else {
|
||||
user, _ := arn.GetUser(external.CreatedBy)
|
||||
shoboiEdits[user.Nick]++
|
||||
}
|
||||
}
|
||||
|
||||
if external.Service == "anilist/anime" {
|
||||
if external.CreatedBy == "" {
|
||||
anilistEdits["Bot"]++
|
||||
} else {
|
||||
user, _ := arn.GetUser(external.CreatedBy)
|
||||
anilistEdits[user.Nick]++
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if anime.GetMapping("shoboi/anime") != "" {
|
||||
shoboi["Connected with Shoboi"]++
|
||||
} else {
|
||||
@ -35,6 +58,8 @@ func Anime(ctx *aero.Context) string {
|
||||
anilist["Not connected with Anilist"]++
|
||||
}
|
||||
|
||||
rating[arn.ToString(int(anime.Rating.Overall+0.5))]++
|
||||
|
||||
status[anime.Status]++
|
||||
types[anime.Type]++
|
||||
}
|
||||
@ -42,7 +67,10 @@ func Anime(ctx *aero.Context) string {
|
||||
return ctx.HTML(components.Statistics(
|
||||
utils.NewPieChart("Type", types),
|
||||
utils.NewPieChart("Status", status),
|
||||
utils.NewPieChart("Rating", rating),
|
||||
utils.NewPieChart("Anilist", anilist),
|
||||
utils.NewPieChart("Anilist Editors", anilistEdits),
|
||||
utils.NewPieChart("Shoboi", shoboi),
|
||||
utils.NewPieChart("Shoboi Editors", shoboiEdits),
|
||||
))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user