From 51ab47ed68b7efc19baea18467c1e14778eeb917 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Thu, 25 Dec 2025 00:07:40 +0000 Subject: [PATCH] Sort contacts by most overdue first --- srv/server.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/srv/server.go b/srv/server.go index 8308a6f..c392dbf 100644 --- a/srv/server.go +++ b/srv/server.go @@ -9,6 +9,7 @@ import ( "net/url" "path/filepath" "runtime" + "sort" "strconv" "strings" "time" @@ -104,6 +105,10 @@ func (s *Server) HandleRoot(w http.ResponseWriter, r *http.Request) { } data.Contacts = append(data.Contacts, cv) } + // Sort by most overdue first + sort.Slice(data.Contacts, func(i, j int) bool { + return data.Contacts[i].DaysOverdue > data.Contacts[j].DaysOverdue + }) } } -- 2.51.2