Shown own progress as well in episode list

This commit is contained in:
Eduard Urbach 2018-11-15 14:22:28 +09:00
parent a12b749ee9
commit 6dc98a695a
2 changed files with 17 additions and 7 deletions

View File

@ -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)

View File

@ -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 {