Fix sortbytodoist and add subtask indenting #115
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I found that when you display a project that has parent tasks with subtasks, the sort order appeared to be very random. When I looked into the code I realised that's because it was sorting based on the 'child-order' field only which made no sense i.e. the first child of every task was sorted together, followed by the second child of every task etc.
I've fixed it up so that now it will sort parent tasks based on their id, and child tasks based on their parents id and their child_order i.e. subtasks will now be sorted under their parents as you would expect.
I also added an indent for the child tasks when sorting this way so it was clearer that they were children of their parent task above.
See the screenshot below for how this looks when you import Todoists's wedding planner template.