sort the zonkzone

This commit is contained in:
Ted Unangst 2019-06-16 14:41:47 -04:00
parent 423d018059
commit bd2e7cf9c7
1 changed files with 15 additions and 0 deletions

15
honk.go
View File

@ -1112,6 +1112,21 @@ func zonkzone(w http.ResponseWriter, r *http.Request) {
rows.Scan(&z.ID, &z.Name, &z.Wherefore)
zonkers = append(zonkers, z)
}
sort.Slice(zonkers, func (i, j int) bool {
w1 := zonkers[i].Wherefore
w2 := zonkers[j].Wherefore
if w1 == w2 {
return zonkers[i].Name < zonkers[j].Name
}
if w1 == "zonvoy" {
w1 = "zzzzzzz"
}
if w2 == "zonvoy" {
w2 = "zzzzzzz"
}
return w1 < w2
})
templinfo := getInfo(r)
templinfo["Zonkers"] = zonkers
templinfo["ZonkCSRF"] = login.GetCSRF("zonkzonk", r)