Sort tgs
This commit is contained in:
parent
e5772ae2ce
commit
9b55805acd
1 changed files with 9 additions and 0 deletions
|
@ -4,6 +4,7 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"slices"
|
||||
|
||||
"dynatron.me/x/stillbox/internal/forms"
|
||||
"dynatron.me/x/stillbox/pkg/database"
|
||||
|
@ -181,6 +182,14 @@ func (tga *talkgroupAPI) getTGsShareRoute(_ ID, w http.ResponseWriter, r *http.R
|
|||
idSl = append(idSl, id)
|
||||
}
|
||||
|
||||
slices.SortFunc(idSl, func(a, b talkgroups.ID) int {
|
||||
if d := int(a.System) - int(b.System); d != 0 {
|
||||
return d
|
||||
}
|
||||
|
||||
return int(a.Talkgroup) - int(b.Talkgroup)
|
||||
})
|
||||
|
||||
tgRes, err := tgs.TGs(ctx, idSl)
|
||||
if err != nil {
|
||||
wErr(w, r, autoError(err))
|
||||
|
|
Loading…
Add table
Reference in a new issue