Fix completing tasks, showing completed tasks, and stable display order. Sorting broken.

This commit is contained in:
Bel LaPointe
2019-11-21 12:11:55 -07:00
parent b6397a71d4
commit 4b5542b833
3 changed files with 16 additions and 4 deletions

View File

@@ -8,6 +8,7 @@ import (
"local/todo-server/server/ajax/task"
"net/http"
"path"
"sort"
"strings"
)
@@ -75,6 +76,9 @@ func (a *Ajax) storageListTasks(listID string, filters ...func(t *task.Task) boo
tasks = append(tasks, task)
}
}
sort.SliceStable(tasks, func(i, j int) bool {
return tasks[i].Created.Before(tasks[j].Created)
})
return tasks, nil
}