improve item sorting

This commit is contained in:
Ruidy 2024-08-26 21:33:41 +02:00
parent 6451bd5926
commit d59a55f8c3
No known key found for this signature in database
GPG key ID: E00F51288CB857CC

View file

@ -139,13 +139,13 @@ func handleBookingPage(bs *booking.Service, hc *config.Host) echo.HandlerFunc {
return sum + i.Price*float64(i.Quantity)
}, 0.0), 'f', 2, 64),
Platforms: hc.Platforms,
ItemList: u.OrderBy(func(items map[string]config.HostItem) (out []string) {
ItemList: u.OrderBy(func(items map[string]config.HostItem) (out []string) { // TODO: return the full item to prefill the form
for _, item := range items {
out = append(out, item.Name)
}
return out
}(hc.Items),
func(l, r string) bool { return l < r },
func(l, r string) bool { return l > r },
),
PaymentMethods: hc.PaymentMethods,
}