list sorting

This commit is contained in:
Erik Winter 2025-01-05 10:55:27 +01:00
parent 35708710f2
commit 190299f272
2 changed files with 6 additions and 3 deletions

BIN
dist/plan vendored

Binary file not shown.

View File

@ -138,6 +138,12 @@ type ListResult struct {
func (lr ListResult) Render() string { func (lr ListResult) Render() string {
sort.Slice(lr.Tasks, func(i, j int) bool { sort.Slice(lr.Tasks, func(i, j int) bool {
if lr.Tasks[i].Task.Date.After(lr.Tasks[j].Task.Date) {
return false
}
if lr.Tasks[j].Task.Date.After(lr.Tasks[i].Task.Date) {
return true
}
if lr.Tasks[i].Task.Project < lr.Tasks[j].Task.Project { if lr.Tasks[i].Task.Project < lr.Tasks[j].Task.Project {
return true return true
} }
@ -150,9 +156,6 @@ func (lr ListResult) Render() string {
if lr.Tasks[i].Task.Recurrer != nil && lr.Tasks[j].Task.Recurrer == nil { if lr.Tasks[i].Task.Recurrer != nil && lr.Tasks[j].Task.Recurrer == nil {
return false return false
} }
if lr.Tasks[i].Task.Date.After(lr.Tasks[j].Task.Date) {
return false
}
return lr.Tasks[i].LocalID < lr.Tasks[j].LocalID return lr.Tasks[i].LocalID < lr.Tasks[j].LocalID
}) })