Improved anime list comparison
This commit is contained in:
parent
6c0f8a6318
commit
fd03d31187
@ -30,12 +30,16 @@ func AnimeList(ctx *aero.Context) string {
|
||||
}
|
||||
|
||||
comparisons := []*utils.Comparison{}
|
||||
countA := 0
|
||||
countB := 0
|
||||
|
||||
for _, item := range a.AnimeList().Items {
|
||||
if item.Status == arn.AnimeListStatusPlanned {
|
||||
continue
|
||||
}
|
||||
|
||||
countA++
|
||||
|
||||
comparisons = append(comparisons, &utils.Comparison{
|
||||
Anime: item.Anime(),
|
||||
ItemA: item,
|
||||
@ -44,7 +48,13 @@ func AnimeList(ctx *aero.Context) string {
|
||||
}
|
||||
|
||||
for _, item := range b.AnimeList().Items {
|
||||
if Contains(comparisons, item.AnimeID) || item.Status == arn.AnimeListStatusPlanned {
|
||||
if item.Status == arn.AnimeListStatusPlanned {
|
||||
continue
|
||||
}
|
||||
|
||||
countB++
|
||||
|
||||
if Contains(comparisons, item.AnimeID) {
|
||||
continue
|
||||
}
|
||||
|
||||
@ -59,7 +69,7 @@ func AnimeList(ctx *aero.Context) string {
|
||||
return comparisons[i].Anime.Popularity.Total() > comparisons[j].Anime.Popularity.Total()
|
||||
})
|
||||
|
||||
return ctx.HTML(components.CompareAnimeList(a, b, comparisons, user))
|
||||
return ctx.HTML(components.CompareAnimeList(a, b, countA, countB, comparisons, user))
|
||||
}
|
||||
|
||||
// Contains ...
|
||||
|
@ -1,5 +1,7 @@
|
||||
component CompareAnimeList(a *arn.User, b *arn.User, comparisons []*utils.Comparison, user *arn.User)
|
||||
h1= "Anime list comparison between " + a.Nick + " and " + b.Nick
|
||||
component CompareAnimeList(a *arn.User, b *arn.User, countA int, countB int, comparisons []*utils.Comparison, user *arn.User)
|
||||
h1 Anime list comparison
|
||||
|
||||
p.comparison-info= a.Nick + "'s list contains " + strconv.Itoa(countA) + " anime and " + b.Nick + "'s list contains " + strconv.Itoa(countB) + " anime."
|
||||
|
||||
table.anime-list
|
||||
thead
|
||||
|
@ -1,3 +1,10 @@
|
||||
.comparison-info
|
||||
text-align center
|
||||
font-size 0.9rem
|
||||
opacity 0.5
|
||||
margin-top 0
|
||||
margin-bottom content-padding
|
||||
|
||||
.comparison
|
||||
width 100px
|
||||
text-align center
|
||||
|
Loading…
Reference in New Issue
Block a user