This commit is contained in:
Jarmo Riikonen 2018-07-03 16:33:35 +03:00
parent a45b259839
commit ed58f31ba2
2 changed files with 3 additions and 1 deletions

View File

@ -58,13 +58,14 @@ func averageScore(user *arn.User, animes []*arn.Anime) float64 {
for _, anime := range animes { for _, anime := range animes {
userAnime := animeList.Find(anime.ID) userAnime := animeList.Find(anime.ID)
if userAnime != nil && !userAnime.Rating.IsNotRated() { if userAnime != nil && !userAnime.Rating.IsNotRated() {
scores += userAnime.Rating.Overall scores += userAnime.Rating.Overall
count++ count++
} }
} }
if count == 0.0 || scores == 0.0 { if count == 0.0 {
return 0 return 0
} }

View File

@ -1,5 +1,6 @@
component Genre(genre string, animes []*arn.Anime, user *arn.User, userScore float64) component Genre(genre string, animes []*arn.Anime, user *arn.User, userScore float64)
h1(title=fmt.Sprint(len(animes)) + " anime")= strings.Title(genre) h1(title=fmt.Sprint(len(animes)) + " anime")= strings.Title(genre)
if user != nil if user != nil
h2= fmt.Sprintf("%.1f", userScore) h2= fmt.Sprintf("%.1f", userScore)