From ce0750db6617a332888ab5458d7581347bac864d Mon Sep 17 00:00:00 2001 From: Bel LaPointe <153096461+breel-render@users.noreply.github.com> Date: Sat, 24 May 2025 14:24:16 -0600 Subject: [PATCH] sort disabled to bot --- go.mod | 2 +- server/list.go | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 35dfa07..41563fd 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module gitea.inhome.blapointe.com/local/firestormy -go 1.17 +go 1.22 require ( gitea.inhome.blapointe.com/local/args v0.0.0-20240109214601-658deda479a4 diff --git a/server/list.go b/server/list.go index 5873ed8..bd6ab32 100755 --- a/server/list.go +++ b/server/list.go @@ -2,12 +2,13 @@ package server import ( "encoding/json" + "net/http" + "sort" + "gitea.inhome.blapointe.com/local/firestormy/config" "gitea.inhome.blapointe.com/local/firestormy/config/ns" "gitea.inhome.blapointe.com/local/firestormy/scheduler" "gitea.inhome.blapointe.com/local/logb" - "net/http" - "sort" ) func (s *Server) list(w http.ResponseWriter, r *http.Request) { @@ -34,6 +35,12 @@ func (s *Server) list(w http.ResponseWriter, r *http.Request) { out[i] = toMap(j, false) } sort.Slice(out, func(i, j int) bool { + if out[i]["disabled"].(bool) == out[j]["disabled"].(bool) { + } else if out[i]["disabled"].(bool) { + return false + } else if out[j]["disabled"].(bool) { + return true + } return out[i]["title"].(string) < out[j]["title"].(string) }) json.NewEncoder(w).Encode(out)