-
Notifications
You must be signed in to change notification settings - Fork 80
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
Improve --sort=due for urgent tasks #524
Comments
I'm not sure this is easy given how our filtering/sorting works right now, it might require some pretty big changes. I think |
Yes the |
I think I fail to see how Anyway, to me it would make sense that todos with no due date should behave as having due date equal to infinity with respect to sorting, rather than zero which seems to be the case now. I have not looked into the code but this could be easy to do especially if sqlite supports this or at least allows for some other special value for the timestamp and custom sorting for it. This might then also relate to #125. |
Ok let me try to explain the differences by the following example:
To get the most urgent todo on the top I use
because
With
Unfortunately this gets more complicated if you use the "Priority" flag on top because of the default sorting behavior of todoman. Your proposal would definitely make sense for the due dates in my opinion and should solve this issue. |
So if I understand correctly, you are rather comparing `todo | tac` with
`todo list --sort=due` than `--no-reverse` with `tac` - is that right? I
only had the first case in mind and I still think that `tac` is not
needed: `todo list --no-reverse` should give exactly the same thing as
`todo | tac` (although this is probably easier to type) in your second
example.
I agree that priorities seem to complicate things. Plain default `todo
list` would be almost enough for me regarding the sorting (and for you
too with `tac`/`--no-reverse`, if I understood correctly), except that
it seems to sort primarily by priority and secondarily by due date. At
the same time though, I currently have one task which has the highest
priority and has a due date set and yet is not sorted among all other
high priority tasks wih due date but instead is further up among high
priority tasks with no due date, so I don't really see at the moment
what the default sorting algorithm is.
|
Now that you mention it, they should yield the same results.
The defaults keep the most urgent one at the bottom. If you have dozens of todos, the most urgent ones will be visible on screen and the less urgent ones are in your terminal's scroll-back buffer. If you want most-urgent-on-top, you want
This is possible right now, e.g.:
The minus inverts the order for just that field. See the updated docs in 27c45f0 Regrettably, the default sorting cannot be expressed via the cli:
|
This is possible right now, e.g.:
todo list --sort due,-priority
This is great!
However I believe my suggestion for no due date being equal to infinity
rather than zero still holds - what do you think about it @WhyNotHugo?
```
completed_at DESC,
priority IS NOT NULL, priority DESC,
due IS NOT NULL, due DESC,
created_at ASC
```
This does not seem to correspond to what I'm seeing: `todo list` returns
```
[ ] 428 !!! in 21 days
[ ] LOTS OF !!! (no due date)
[ ] 498 !!! in 11 months
[...]
[ ] 502 !!! 19 hours ago
```
for me. I wonder, if it's just some database corruption though. I will
try to refresh the cache later.
|
However I believe my suggestion for no due date being equal to infinity
rather than zero still holds - what do you think about it @WhyNotHugo?
So looking at your example, this would translate to something like `todo
list --sort=due` going over to `due IS NOT NULL, due DESC` and `todo
list --sort=-due` to `due IS NULL, due ASC`.
And again inspired by your example, I additionally think that this would
make sense for priority also (i. e. no priority set should indeed mean
no priority).
And regarding the `tac`/`--no-reverse` equivalence, it does not seem to
yield the same results for me after all. I don't know why I thought it
does before but it seems to me that exactly the NULL conditions
remaining the same (i. e. IS NOT NULL for both with and without
`--no-reverse`, instead of IS NULL in the latter case) is the reason why
it does not.
|
Yes as you said the results of Thanks for your hint with the advanced sorting functionality and the docu @WhyNotHugo ! |
The advanced sorting was already there, it was just undocumented (and I'd honestly forgotten about it, I don't think that I wrote it). I think we can add support for something like |
I think we can add support for something like `--sort=due:null-first` or `--sort=due:null-last`.
That would probably be a good compromise, although personally I would be
fine with it being fixed in the way that I described above because it
feels natural (to me at least). @mst, what do you think?
@WhyNotHugo Regarding `--no-reverse`, as it seems that it does not have
the same effect as `tac` but rather seems to globally apply `-` to all
sorting conditions individually, perhaps it could be obsoleted and
removed after the above NULL suggestions are resolved?
|
Once we have support for |
It would be nice to have a sorted todo list with the most urgent task on the top.
Currently the
todo list --sort=due
command shows all tasks with a due date on top in the reverse order (least urgent first).Adding the
--no-reverse
option shows the tasks with due date in the wanted order, however the tasks without due date are listed on the top.Expected behavior: The tasks without due date should always be listed below the tasks with due date.
As a general improvement it would be nice to chain sort (and reverse) parameters, so that you could end up with a prioritized list of tasks, for example:
to show a list sorted by due date and within the same due date by priority (i.e. for tasks without due date).
The text was updated successfully, but these errors were encountered: