Small refactorings

This commit is contained in:
Ashley Allen 2018-07-28 15:47:25 +01:00
parent 8891ea4369
commit 320649b81d
2 changed files with 10 additions and 9 deletions

View File

@ -84,12 +84,10 @@ func totalCompleted(user *arn.User, animes []*arn.Anime) int {
completedList := user.AnimeList().FilterStatus(arn.AnimeListStatusCompleted)
for _, anime := range animes {
userAnime := completedList.Find(anime.ID)
if userAnime != nil {
count++;
if completedList.Contains(anime.ID) {
count++
}
}
return count;
return count
}

View File

@ -1,9 +1,7 @@
component Genre(genre string, animes []*arn.Anime, user *arn.User, userScore float64, userCompleted int)
h1(title=fmt.Sprint(len(animes)) + " anime")= strings.Title(genre)
if user != nil
.average-score-total-completed
p= fmt.Sprintf("Average rating: %." + strconv.Itoa(user.Settings().Format.RatingsPrecision) + "f | Total completed: %d", userScore, userCompleted)
GenreStatistics(user, userScore, userCompleted)
.corner-buttons-hide-on-mobile
if user != nil
@ -14,3 +12,8 @@ component Genre(genre string, animes []*arn.Anime, user *arn.User, userScore flo
RawIcon("clone")
AnimeGrid(animes, user)
component GenreStatistics(user *arn.User, userScore float64, userCompleted int)
if user != nil
.average-score-total-completed
p= fmt.Sprintf("Average rating: %." + strconv.Itoa(user.Settings().Format.RatingsPrecision) + "f | Total completed: %d", userScore, userCompleted)