From 6dc98a695aa98674bccd0c6e5a804cc29ef259f3 Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Thu, 15 Nov 2018 14:22:28 +0900 Subject: [PATCH] Shown own progress as well in episode list --- pages/anime/anime.go | 18 +++++++++++------- pages/anime/episodes.go | 6 ++++++ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/pages/anime/anime.go b/pages/anime/anime.go index 7a90a338..a02aa89a 100644 --- a/pages/anime/anime.go +++ b/pages/anime/anime.go @@ -27,6 +27,13 @@ func Get(ctx *aero.Context) string { return ctx.Error(http.StatusNotFound, "Anime not found", err) } + // Anime list item + var animeListItem *arn.AnimeListItem + + if user != nil { + animeListItem = user.AnimeList().Find(anime.ID) + } + // Episodes episodes := anime.Episodes().Items @@ -61,6 +68,10 @@ func Get(ctx *aero.Context) string { } } + if animeListItem != nil { + episodeToFriends[animeListItem.Episodes] = append(episodeToFriends[animeListItem.Episodes], user) + } + arn.SortUsersLastSeenFirst(friends) } @@ -108,13 +119,6 @@ func Get(ctx *aero.Context) string { return len(amvs[i].Likes) > len(amvs[j].Likes) }) - // Anime list item - var animeListItem *arn.AnimeListItem - - if user != nil { - animeListItem = user.AnimeList().Find(anime.ID) - } - // Open Graph ctx.Data = getOpenGraph(ctx, anime) diff --git a/pages/anime/episodes.go b/pages/anime/episodes.go index 6044736f..5ed7e5f2 100644 --- a/pages/anime/episodes.go +++ b/pages/anime/episodes.go @@ -26,6 +26,12 @@ func Episodes(ctx *aero.Context) string { episodeToFriends[friendAnimeListItem.Episodes] = append(episodeToFriends[friendAnimeListItem.Episodes], friend) } } + + ownListItem := user.AnimeList().Find(anime.ID) + + if ownListItem != nil { + episodeToFriends[ownListItem.Episodes] = append(episodeToFriends[ownListItem.Episodes], user) + } } if err != nil {