Fix bug for ordering checkboxes

This commit is contained in:
Peter Stuifzand 2021-08-11 22:32:45 +02:00
parent 27bc12146c
commit bbbf82ff93

View File

@ -56,10 +56,10 @@ function sort(id, property, direction) {
let children = this.getChildren(id) let children = this.getChildren(id)
if (property === 'todo') { if (property === 'todo') {
children = _.orderBy(children, item => { children = _.orderBy(children, item => {
let res = item.text.match(/^#\[\[(TODO|DONE)/) const res = item.text.match(/^#\[\[(TODO|DONE)/)
if (!res) return "C"; if (!res) return "C";
if (res[1] === 'TODO') return direction === 'asc' ? "A" : "B"; if (res[1] === 'TODO') return "A";
if (res[1] === 'DONE') return direction === 'asc' ? "B" : "A"; if (res[1] === 'DONE') return "B";
return "D"; return "D";
}, direction) }, direction)
} else { } else {