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

Raw filters don't seem to be working as intended #113

Open
yohannd1 opened this issue Apr 19, 2022 · 1 comment
Open

Raw filters don't seem to be working as intended #113

yohannd1 opened this issue Apr 19, 2022 · 1 comment

Comments

@yohannd1
Copy link

yohannd1 commented Apr 19, 2022

Let's say I have a task folder in ~/_sample_data.
The output of unset TASKRC; task rc.data.location=~/_sample_data is (removing the "configuration override" notes):

ID Age  Tag   Description  Urg
 2 5min habit another task  0.8
 1 5min       sample task     0

2 tasks

I then tried to use it this way:

from tasklib import TaskWarrior
import os

del os.environ["TASKRC"] # just to be sure it isn't my config's fault
tw = TaskWarrior(f"{os.environ['HOME']}/_sample_data")

print(tw.tasks.filter("status:pending")) # yields the two tasks
print(tw.tasks.filter("status:pending +habit")) # yields no task (was supposed to yield one)
print(tw.tasks.filter("+habit")) # yields one task, as expected
print(tw.tasks.filter(status="pending", tag="habit")) # yields one task ~ this one works fine as well

The shown output is then:

[sample task, another task]
[]
[another task]
[another task]

But what was expected:

[sample task, another task]
[another task]
[another task]
[another task]

It seems like only raw filters that have more than one condition are affected by this.

@yohannd1
Copy link
Author

After some debugging I've noticed that the command that fails (the second one) is being called as so:

['task', 'rc.confirmation=no', 'rc.dependency.confirmation=no', 'rc.recurrence.confirmation=no', 'rc.json.array=off', 'rc.bulk=0', 'rc.data.location=/home/yohanan/_sample_data', 'status:pending +habit', 'export']

I've went and tried this command out and noticed that sending the whole "status:pending +habit" as a single argument doesn't seem to work on taskwarrior, instead requiring each condition to be a whole different argument or the entire single argument to be wrapped by parenthesis.
So: task status:pending +habit and task "(status:pending +habit)" both work but task "status:pending +habit" doesn't.
I'm not sure how this should be tackled on tasklib (maybe it has been tackled before but something went wrong). Since task "(status:pending +habit)" works fine, maybe we could just add parenthesis if the query has parenthesis? I'm not sure if that solves the problem completely.

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

No branches or pull requests

1 participant