Added soundtrack stats
This commit is contained in:
parent
045879001f
commit
7b10997ef6
@ -3,6 +3,7 @@ package profile
|
|||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/aerogo/aero"
|
"github.com/aerogo/aero"
|
||||||
@ -24,6 +25,7 @@ func GetStatsByUser(ctx *aero.Context) string {
|
|||||||
years := stats{}
|
years := stats{}
|
||||||
studios := stats{}
|
studios := stats{}
|
||||||
genres := stats{}
|
genres := stats{}
|
||||||
|
trackTags := stats{}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ctx.Error(http.StatusNotFound, "User not found", err)
|
return ctx.Error(http.StatusNotFound, "User not found", err)
|
||||||
@ -72,6 +74,20 @@ func GetStatsByUser(ctx *aero.Context) string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for track := range arn.StreamSoundTracks() {
|
||||||
|
if !track.LikedBy(viewUser.ID) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, tag := range track.Tags {
|
||||||
|
if strings.Contains(tag, ":") {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
trackTags[tag]++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
userStats.PieCharts = []*arn.PieChart{
|
userStats.PieCharts = []*arn.PieChart{
|
||||||
arn.NewPieChart("Genres", genres),
|
arn.NewPieChart("Genres", genres),
|
||||||
arn.NewPieChart("Studios", studios),
|
arn.NewPieChart("Studios", studios),
|
||||||
@ -79,6 +95,7 @@ func GetStatsByUser(ctx *aero.Context) string {
|
|||||||
arn.NewPieChart("Ratings", ratings),
|
arn.NewPieChart("Ratings", ratings),
|
||||||
arn.NewPieChart("Types", types),
|
arn.NewPieChart("Types", types),
|
||||||
arn.NewPieChart("Status", status),
|
arn.NewPieChart("Status", status),
|
||||||
|
arn.NewPieChart("Soundtracks", trackTags),
|
||||||
}
|
}
|
||||||
|
|
||||||
return ctx.HTML(components.ProfileStats(&userStats, viewUser, utils.GetUser(ctx), ctx.URI()))
|
return ctx.HTML(components.ProfileStats(&userStats, viewUser, utils.GetUser(ctx), ctx.URI()))
|
||||||
|
Loading…
Reference in New Issue
Block a user