From dd6693a9d27fe1091982e15c233d551bd073290d Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Fri, 16 Nov 2018 17:57:56 +0900 Subject: [PATCH] Show friends in reverse order --- pages/anime/anime.go | 8 ++++---- pages/anime/episodes.go | 12 ++++++------ pages/anime/episodes.pixy | 3 ++- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/pages/anime/anime.go b/pages/anime/anime.go index a02aa89a..50376ad0 100644 --- a/pages/anime/anime.go +++ b/pages/anime/anime.go @@ -50,6 +50,10 @@ func Get(ctx *aero.Context) string { friends = user.Follows().Users() deleted := 0 + if animeListItem != nil { + episodeToFriends[animeListItem.Episodes] = append(episodeToFriends[animeListItem.Episodes], user) + } + for i := range friends { j := i - deleted friend := friends[j] @@ -68,10 +72,6 @@ func Get(ctx *aero.Context) string { } } - if animeListItem != nil { - episodeToFriends[animeListItem.Episodes] = append(episodeToFriends[animeListItem.Episodes], user) - } - arn.SortUsersLastSeenFirst(friends) } diff --git a/pages/anime/episodes.go b/pages/anime/episodes.go index 5ed7e5f2..a448874e 100644 --- a/pages/anime/episodes.go +++ b/pages/anime/episodes.go @@ -18,6 +18,12 @@ func Episodes(ctx *aero.Context) string { episodeToFriends := map[int][]*arn.User{} if user != nil { + ownListItem := user.AnimeList().Find(anime.ID) + + if ownListItem != nil { + episodeToFriends[ownListItem.Episodes] = append(episodeToFriends[ownListItem.Episodes], user) + } + for _, friend := range user.Follows().Users() { friendAnimeList := friend.AnimeList() friendAnimeListItem := friendAnimeList.Find(anime.ID) @@ -26,12 +32,6 @@ 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 { diff --git a/pages/anime/episodes.pixy b/pages/anime/episodes.pixy index 77044657..b92bd38d 100644 --- a/pages/anime/episodes.pixy +++ b/pages/anime/episodes.pixy @@ -23,6 +23,7 @@ component AnimeEpisodes(anime *arn.Anime, episodes []*arn.AnimeEpisode, episodeT if validate.DateTime(episode.AiringDate.Start) .episode-airing-date-start.utc-airing-date.no-tip(data-start-date=episode.AiringDate.Start, data-end-date=episode.AiringDate.End, data-episode-number=episode.Number)= episode.AiringDate.StartDateHuman() + //- Show friends in reverse order .episode-friends - each friend in episodeToFriends[episode.Number] + each friend in episodeToFriends[episode.Number] reversed AvatarNoLink(friend)