Minor performance improvement

This commit is contained in:
Eduard Urbach 2017-12-04 22:23:31 +01:00
parent f03df2b6ac
commit 66f0cd8fe5

View File

@ -33,7 +33,10 @@ func AnimeList(ctx *aero.Context) string {
countA := 0 countA := 0
countB := 0 countB := 0
for _, item := range a.AnimeList().Items { animeListA := a.AnimeList()
animeListB := b.AnimeList()
for _, item := range animeListA.Items {
if item.Status == arn.AnimeListStatusPlanned { if item.Status == arn.AnimeListStatusPlanned {
continue continue
} }
@ -43,11 +46,11 @@ func AnimeList(ctx *aero.Context) string {
comparisons = append(comparisons, &utils.Comparison{ comparisons = append(comparisons, &utils.Comparison{
Anime: item.Anime(), Anime: item.Anime(),
ItemA: item, ItemA: item,
ItemB: b.AnimeList().Find(item.AnimeID), ItemB: animeListB.Find(item.AnimeID),
}) })
} }
for _, item := range b.AnimeList().Items { for _, item := range animeListB.Items {
if item.Status == arn.AnimeListStatusPlanned { if item.Status == arn.AnimeListStatusPlanned {
continue continue
} }
@ -60,7 +63,7 @@ func AnimeList(ctx *aero.Context) string {
comparisons = append(comparisons, &utils.Comparison{ comparisons = append(comparisons, &utils.Comparison{
Anime: item.Anime(), Anime: item.Anime(),
ItemA: a.AnimeList().Find(item.AnimeID), ItemA: animeListA.Find(item.AnimeID),
ItemB: item, ItemB: item,
}) })
} }