feat: add due date to list sorting priority

Sort nodes by: status → priority → due date (soonest first).
Nodes without due dates sort last.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-04-02 04:57:51 +02:00
parent a30c703efa
commit 8357c80e75

View File

@@ -76,7 +76,21 @@ func PrintNodes(w io.Writer, svc service.NodeService, nodes []*models.Node, json
if si != sj {
return statusRanks[si] > statusRanks[sj]
}
return prioRanks[nodes[i].GetProperty("prio")] > prioRanks[nodes[j].GetProperty("prio")]
pi, pj := prioRanks[nodes[i].GetProperty("prio")], prioRanks[nodes[j].GetProperty("prio")]
if pi != pj {
return pi > pj
}
di, dj := nodes[i].DueDate, nodes[j].DueDate
if di == nil && dj == nil {
return false
}
if di == nil {
return false
}
if dj == nil {
return true
}
return di.Before(dj.Time) // soonest due date first
})
for _, n := range nodes {