Show friends in reverse order

This commit is contained in:
Eduard Urbach 2018-11-16 17:57:56 +09:00
parent 70a2cc275d
commit dd6693a9d2
3 changed files with 12 additions and 11 deletions

View File

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

View File

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

View File

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