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 + }) } }