New statistics
This commit is contained in:
parent
e5e8cd9d25
commit
92c6a7e4b4
@ -20,6 +20,7 @@ func main() {
|
|||||||
Name: "Users",
|
Name: "Users",
|
||||||
PieCharts: userStats,
|
PieCharts: userStats,
|
||||||
}))
|
}))
|
||||||
|
|
||||||
arn.PanicOnError(arn.DB.Set("Cache", "anime statistics", &arn.StatisticsCategory{
|
arn.PanicOnError(arn.DB.Set("Cache", "anime statistics", &arn.StatisticsCategory{
|
||||||
Name: "Anime",
|
Name: "Anime",
|
||||||
PieCharts: animeStats,
|
PieCharts: animeStats,
|
||||||
@ -40,6 +41,8 @@ func getUserStats() []*arn.PieChart {
|
|||||||
country := stats{}
|
country := stats{}
|
||||||
gender := stats{}
|
gender := stats{}
|
||||||
os := stats{}
|
os := stats{}
|
||||||
|
notifications := stats{}
|
||||||
|
activity := stats{}
|
||||||
|
|
||||||
for _, info := range analytics {
|
for _, info := range analytics {
|
||||||
pixelRatio[fmt.Sprintf("%.1f", info.Screen.PixelRatio)]++
|
pixelRatio[fmt.Sprintf("%.1f", info.Screen.PixelRatio)]++
|
||||||
@ -68,6 +71,18 @@ func getUserStats() []*arn.PieChart {
|
|||||||
|
|
||||||
os[user.OS.Name]++
|
os[user.OS.Name]++
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(user.PushSubscriptions().Items) > 0 {
|
||||||
|
notifications["Enabled"]++
|
||||||
|
} else {
|
||||||
|
notifications["Disabled"]++
|
||||||
|
}
|
||||||
|
|
||||||
|
if user.IsActive() {
|
||||||
|
activity["Active last week"]++
|
||||||
|
} else {
|
||||||
|
activity["Inactive"]++
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
println("Finished user statistics")
|
println("Finished user statistics")
|
||||||
@ -77,6 +92,8 @@ func getUserStats() []*arn.PieChart {
|
|||||||
arn.NewPieChart("Screen size", screenSize),
|
arn.NewPieChart("Screen size", screenSize),
|
||||||
arn.NewPieChart("Browser", browser),
|
arn.NewPieChart("Browser", browser),
|
||||||
arn.NewPieChart("Country", country),
|
arn.NewPieChart("Country", country),
|
||||||
|
arn.NewPieChart("Activity", activity),
|
||||||
|
arn.NewPieChart("Notifications", notifications),
|
||||||
arn.NewPieChart("Gender", gender),
|
arn.NewPieChart("Gender", gender),
|
||||||
arn.NewPieChart("Pixel ratio", pixelRatio),
|
arn.NewPieChart("Pixel ratio", pixelRatio),
|
||||||
}
|
}
|
||||||
|
28
patches/add-episodes/add-episodes.go
Normal file
28
patches/add-episodes/add-episodes.go
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/animenotifier/arn"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
count := 0
|
||||||
|
|
||||||
|
for anime := range arn.MustStreamAnime() {
|
||||||
|
episodes := anime.Episodes()
|
||||||
|
|
||||||
|
if episodes == nil {
|
||||||
|
episodes = &arn.AnimeEpisodes{
|
||||||
|
AnimeID: anime.ID,
|
||||||
|
Items: []*arn.AnimeEpisode{},
|
||||||
|
}
|
||||||
|
|
||||||
|
if episodes.Save() == nil {
|
||||||
|
count++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Println("Added empty anime episodes to", count, "anime.")
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user