23 lines
365 B
Go
Raw Normal View History

2018-04-16 13:48:54 +00:00
package amvs
import (
"sort"
"github.com/aerogo/aero"
)
// Best AMVs.
2019-06-01 04:55:49 +00:00
func Best(ctx aero.Context) error {
2018-04-16 13:48:54 +00:00
amvs := fetchAll()
sort.Slice(amvs, func(i, j int) bool {
if len(amvs[i].Likes) == len(amvs[j].Likes) {
return amvs[i].Title.String() < amvs[j].Title.String()
}
return len(amvs[i].Likes) > len(amvs[j].Likes)
})
return render(ctx, amvs)
}