GothenburgBitFactory / GothenburgBitFactory/taskwarrior
Cannot filter between unset durations and configured zero-duration values
- Dominant language
- C++
- Stars
- 6.1k
- Forks
- 423
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 11
Description
Zero durations match the empty string, and therefore there is no way to filter tasks that have explicit zero duration values.
The clearest example of the problem is thus:
$ task calc PT0S = '""'
true
I'd expect that result to be `false`.
The real problem for me is that I have a duration UDA and I'd like to be able to filter tasks where it's set, but I can't distinguish between cases where it's set to a zero value and where it's not set at all. Example output below, with extraneous lines removed:
```
$ task rc:taskrcdemo rc.data.location:taskdemo config uda.durationdemo.type duration
$ task rc:taskrcdemo rc.data.location:taskdemo add Demo task without duration
Created task 1.
$ task rc:taskrcdemo rc.data.location:taskdemo add Demo task with non-zero duration durationdemo:P1D
Created task 2.
$ task rc:taskrcdemo rc.data.location:taskdemo add Demo task with zero duration durationdemo:P0D
Created task 3.
$ task rc:taskrcdemo rc.data.location:taskdemo all
ID St UUID Age Description
3 P 81709d81 5s Demo task with zero duration
2 P 716417ab 15s Demo task with non-zero duration
1 P daa8f55b 27s Demo task without duration
$ task rc:taskrcdemo rc.data.location:taskdemo 'durationdemo = ""' all # I expect this to only show task 1, the task without a `durationdemo` value
ID St UUID Age Description
3 P 81709d81 22s Demo task with zero duration
1 P daa8f55b 44s Demo task without duration
$ task rc:taskrcdemo rc.data.location:taskdemo 'durationdemo != ""' all # I expect this to show tasks 2 and 3, the tasks with `durationdemo` values
ID St UUID Age Description
2 P 716417ab 38s Demo task with non-zero duration
```
Diag output below:
```
$ task rc:taskrcdemo rc.data.location:taskdemo diag
TASKRC override: taskrcdemo
TASKDATA override: taskdemo
task 2.6.2
Platform: Linux
Compiler
Version: 11.2.0
Caps: +stdc +stdc_hosted +LP64 +c8 +i32 +l64 +vp64 +time_t64
Compliance: C++17
Build Features
CMake: 3.23.0
libuuid: libuuid + uuid_unparse_lower
libgnutls: 3.7.3
Build type: None
Configuration
File: taskrcdemo (found), 1402 bytes, mode 100644
Data: taskdemo (found), dir, mode 40755
Locking: Enabled
GC: Enabled
$VISUAL: vim
Server:
CA: -
Certificate: -
Key: -
Trust: strict
Ciphers: NORMAL
Creds:
Hooks
System: Enabled
Location: taskdemo/hooks
(-none-)
Tests
Terminal: 355x76
Dups: Scanned 3 tasks for duplicate UUIDs:
No duplicates found
Broken ref: Scanned 3 tasks for broken references:
No broken references found
Configuration override rc.data.location:taskdemo
```
Contributor guide
Assessment
This issue has not been assessed yet.