From 5e442e8f7237c0cfc143ad0e9352bca5f1344187 Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Fri, 8 May 2020 16:32:30 +0900 Subject: [PATCH] Fixed watching time --- pages/profile/profile.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pages/profile/profile.go b/pages/profile/profile.go index d6f100ce..19f8ee81 100644 --- a/pages/profile/profile.go +++ b/pages/profile/profile.go @@ -59,14 +59,16 @@ func Profile(ctx aero.Context, viewUser *arn.User) error { var topStudios []*arn.Company for _, item := range animeList.Items { + anime := item.Anime() + currentWatch := item.Episodes * anime.EpisodeLength + reWatch := item.RewatchCount * anime.EpisodeCount * anime.EpisodeLength + duration := time.Duration(currentWatch + reWatch) + animeWatchingTime += duration * time.Minute + if item.Status != arn.AnimeListStatusCompleted { continue } - currentWatch := item.Episodes * item.Anime().EpisodeLength - reWatch := item.RewatchCount * item.Anime().EpisodeCount * item.Anime().EpisodeLength - duration := time.Duration(currentWatch + reWatch) - animeWatchingTime += duration * time.Minute rating := 0.0 if item.Rating.Overall != 0 { @@ -76,7 +78,7 @@ func Profile(ctx aero.Context, viewUser *arn.User) error { rating = 0.1 } - for _, studio := range item.Anime().Studios() { + for _, studio := range anime.Studios() { affinity, exists := studios[studio.ID] if !exists {