-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes sort issue #128
base: master
Are you sure you want to change the base?
Fixes sort issue #128
Conversation
Hi @tejas-hosamani thanks for the contribution, I did some blaming and find out the code for sorting is removed when I try to optimize the task parsing with async functions. I will build and test with your code, it will be merged in the next release if it goes well! |
Sounds good, thank you! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @tejas-hosamani please read the comments and check if there are changes needed.
let taskList = adapter.getTaskList(); | ||
|
||
const sortOptionFn = (0, eval)(this.userOptionModel.get("sort") || "") | ||
if (sortOptionFn) taskList = taskList.sort(sortOptionFn) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorting tasks here might not work cauze some fields of the task items might not get parsed yet.
you need to sort after all the meta infos are parsed.
|
||
const sortOptionFn = (0, eval)(this.userOptionModel.get("sort") || "") | ||
if (sortOptionFn) taskList = taskList.sort(sortOptionFn) | ||
|
||
const taskListPromise = this.parseTasks(taskList) | ||
taskListPromise.then(tasks => { | ||
tasks = this.filterTasks(tasks); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add your sorting code after this would be good.
Fixes issue - #127