perf: 搜索排序

This commit is contained in:
kuaifan 2022-09-20 17:10:24 +08:00
parent ef85282777
commit 7d772542ee
6 changed files with 14 additions and 5 deletions

View File

@ -1,6 +1,6 @@
{
"name": "DooTask",
"version": "0.20.20",
"version": "0.20.23",
"description": "DooTask is task management system.",
"scripts": {
"start": "./cmd dev",

2
public/js/app.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
8b8b6345426f7692
38a09a69a7591dbd

View File

@ -286,12 +286,21 @@ export default {
})
}
return list.sort((a, b) => {
//
a._by_search = a.is_search === true ? 1 : 0
b._by_search = b.is_search === true ? 1 : 0
if (a._by_search || b._by_search) {
return a._by_search - b._by_search
}
//
if (a.top_at || b.top_at) {
return $A.Date(b.top_at) - $A.Date(a.top_at);
}
//
if (a.todo_num > 0 || b.todo_num > 0) {
return b.todo_num - a.todo_num;
}
//
return $A.Date(b.last_at) - $A.Date(a.last_at);
})
},