Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tejas-hosamani
Copy link

@tejas-hosamani tejas-hosamani commented Jul 6, 2024

Fixes issue - #127

image

@Leonezz
Copy link
Owner

Leonezz commented Jul 8, 2024

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!

@tejas-hosamani
Copy link
Author

Sounds good, thank you!

Copy link
Owner

@Leonezz Leonezz left a 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)
Copy link
Owner

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);
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants