Explicit PrefetchAnime call

This commit is contained in:
2017-07-05 14:34:33 +02:00
parent 9d28c652c0
commit a94b69d671
5 changed files with 6 additions and 15 deletions

View File

@ -47,27 +47,14 @@ func dashboard(ctx *aero.Context) string {
}
animeList = animeList.WatchingAndPlanned()
var keys []string
animeList.PrefetchAnime()
for _, item := range animeList.Items {
keys = append(keys, item.AnimeID)
}
objects, getErr := arn.DB.GetMany("Anime", keys)
if getErr != nil {
return
}
allAnimeInList := objects.([]*arn.Anime)
for _, anime := range allAnimeInList {
if len(upcomingEpisodes) >= maxScheduleItems {
break
}
futureEpisodes := anime.UpcomingEpisodes()
futureEpisodes := item.Anime().UpcomingEpisodes()
if len(futureEpisodes) == 0 {
continue