timewarrior icon indicating copy to clipboard operation
timewarrior copied to clipboard

I want to be able to exclude certain tags from reports

Open hiliev opened this issue 5 years ago • 9 comments

I find the combination of Taskwarrior and Timewarrior really great, but there is a minor inconvenience in the way TImewarrior works. In Taskwarrior--and that doesn't seem to be properly documented--one can use exclude filters with something like -tag to filter out tasks that have a particular tag. The same functionality doesn't seem to be supported in Timewarrior, which instead treats - in -tag as part of the tag name.

Use case: I use my desktop computer mainly for work, but from time to time I do some tasks that are not related to work. Those tasks are a relatively low in number and I tag them private. I would like to be able to exclude them from the reports. Currently, the only options are to tag all other tasks as work and then use timew summary work or to manually subtract the time for private tasks from the totals, which doesn't work for reports. It would be easier if I could just do something like timew month -private.

hiliev avatar Feb 26 '19 19:02 hiliev

I have a PoC implementation of filtering with "negative" tags here: https://github.com/hiliev/timewarrior/commit/025b36c051c70fef2beeb456df5ef9ad9221f2e9 It pushes the logic for handling negative tags inside Interval::has, basically defining that an interval has a negative tag if it doesn't have the tag itself.

If you consider this a viable solution, I'd be glad to submit a PR. It doesn't seem to break any of the current tests.

hiliev avatar Mar 03 '19 12:03 hiliev

I do not think the Interval::has function is the right place for filtering logic, especially if one wants to combine it with some other filtering like or or and as requested in #64.

lauft avatar Mar 03 '19 14:03 lauft

I totally get it that mine is not a universal solution since --tag does not equal tag, though it should otherwise work in arbitrary boolean expressions as long as the logic is implemented in matchesFilter and a minus sign is kept as part of the tag name after the expression is simplified. Speaking of universality, what are the chances of a Taskwarrior-style expression engine making its way into Timewarrior anytime soon?

hiliev avatar Mar 03 '19 15:03 hiliev

+1

I would like to be able to get a report "all tasks which do not have this tag" ...

For instance, it can be very useful to get/show the list of tasks which may be an interference to a project (the hereby named tag).

bertrand-benoit avatar Mar 14 '19 09:03 bertrand-benoit

+1!

I really miss a "summary for all intervals today except the ones tagged X". In general due to the way my tags are organized I would benefit immensely from boolean logic in reports (or just NOT).

pchr8 avatar Sep 28 '19 17:09 pchr8

Just +1-ing here, that'd be really useful (my own reason of doing that is in #297)

nodens avatar Mar 06 '20 08:03 nodens

+1

gertjandemulder avatar Sep 25 '22 10:09 gertjandemulder

+1 I reach for this daily.

sjfloat avatar Feb 06 '23 15:02 sjfloat

Naturally I tried -tag and then encounter the same problem and found this thread. +1

LiyinZ avatar Jul 11 '23 00:07 LiyinZ