Show character ranking in info table
This commit is contained in:
@ -1,22 +1,15 @@
|
||||
package characters
|
||||
|
||||
import (
|
||||
"sort"
|
||||
|
||||
"github.com/aerogo/aero"
|
||||
"github.com/animenotifier/arn"
|
||||
)
|
||||
|
||||
// Best characters.
|
||||
func Best(ctx *aero.Context) string {
|
||||
characters := fetchAll()
|
||||
|
||||
sort.Slice(characters, func(i, j int) bool {
|
||||
if len(characters[i].Likes) == len(characters[j].Likes) {
|
||||
return characters[i].Name.Canonical < characters[j].Name.Canonical
|
||||
}
|
||||
|
||||
return len(characters[i].Likes) > len(characters[j].Likes)
|
||||
})
|
||||
arn.SortCharactersByLikes(characters)
|
||||
|
||||
return render(ctx, characters)
|
||||
}
|
||||
|
Reference in New Issue
Block a user