Compare commits

..

No commits in common. "e32c2391a0bfa655355aec117fcc004be64ff9d0" and "27bc12146c00184804d408baf60ccf8169c6a2a4" have entirely different histories.

View File

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