taskwarrior icon indicating copy to clipboard operation
taskwarrior copied to clipboard

Is sorting on task dependency broken or is my configuration wrong?

Open ifohancroft opened this issue 4 years ago • 4 comments

Basically, this is what I get when I execute 'task project:ToDo':

ID   Description Project Depends
147 Redacted   ToDo
152 Redacted   ToDo    147
148 Redacted   ToDo    149
149 Redacted   ToDo    150
150 Redacted   ToDo    151
151 Redacted   ToDo    152

This is what I expect to get:

ID   Description Project Depends
147 Redacted   ToDo
152 Redacted   ToDo    147
151 Redacted   ToDo    152
150 Redacted   ToDo    151
149 Redacted   ToDo    150
148 Redacted   ToDo    149

I have a custom report called ifohancroft that gets executed when I execute task. Here is the config line setting that: default.command=ifohancroft.

Here is my report config:

report.ifohancroft.columns=id,description,project,tags,depends,priority
report.ifohancroft.description=ifohancroft's custom report
report.ifohancroft.filter=status:pending
report.ifohancroft.labels=ID,Description,Project,Tags,Depends,Priority
report.ifohancroft.sort=project,depends,priority-

Here are my settings for the priority column:

uda.priority.type=numeric
uda.priority.label=Priority
uda.priority.values=100,99,98,97,96,95,94,93,92,91,90,89,88,87,86,85,84,83,82,81,80,79,78,77,76,75,74,73,72,71,70,69,68,67,66,65,64,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,2
9,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,

In terms of sorting expectations when listing all tasks/from various projects, I expect to first see tasks from one project, then tasks for another, then another, etc. The tasks for the same project to show sorted based on the task they depend on (as explained above) if there are tasks they depend on and then based on priority. I don't think I have a particular expectation of how tasks that have both priority and depending on another should show up.

The part that currently works is I see task from one project first, then another, etc. Sorting based on priority also works, but not the depend part.

I am currently running TaskWarrior version 2.6.1

ifohancroft avatar Dec 21 '21 19:12 ifohancroft

Is it possible that the dependencies are sorted, but they are sorted in a numerical fashion (it looks so from your example output)?

tbabej avatar Dec 22 '21 15:12 tbabej

Yeah, it looks like they are sorted numerically, ascending I think. Shouldn't they be sorted in logical order though (I mean the way one would expect tasks to be sorted when sorting on dependency) and is there a way to sort them that way?

ifohancroft avatar Dec 22 '21 15:12 ifohancroft

You could try changing that column from depends to depends.count, which will lose the information about what task you depend on, but it will at least sort tasks in a natural way from least blocked to most blocked.

But I agree a more logical way of sorting even for direct depends column would be nice improvement. There are couple of options:

  • from least blocked task to most blocked task
  • hierarchical like-sort (tasks with their "subtasks" underneath them, where possible)
  • perhaps others?

tbabej avatar Dec 22 '21 15:12 tbabej

I think what I am looking for as a way to sort depend is called hierarchial, so you'd get the expected data example from the first post.

ifohancroft avatar Feb 01 '22 20:02 ifohancroft