diff --git a/pkg/web/handler/dashboard.go b/pkg/web/handler/dashboard.go index 4c32a37..6184afd 100644 --- a/pkg/web/handler/dashboard.go +++ b/pkg/web/handler/dashboard.go @@ -2,6 +2,7 @@ package handler import ( "net/http" + "sort" "strings" "github.com/LazyBachelor/LazyPM/internal/models" @@ -20,6 +21,11 @@ func DashboardHandler(w http.ResponseWriter, r *http.Request) { return } + // Sort issues by highest priority first (4 -> 0) + sort.Slice(issues, func(i, j int) bool { + return issues[i].Priority > issues[j].Priority + }) + // Check if board view is requested isBoardView := r.URL.Query().Get("board") == "true"