GothenburgBitFactory / GothenburgBitFactory/taskwarrior

Tag coefficient not applied when multiple tags exist on a task

Open
#3,726 10 comments 1 reaction 0 assignees View on GitHub
type:bug
Dominant language
C++
Stars
6.1k
Forks
423
Avg merge
1d 19h
Merged PRs (30d)
11

Description

Given the following configuration:

```ini
data.location=.
hooks.location=./hooks

urgency.uda.tags.foo.coefficient=10
urgency.uda.tags.bar.coefficient=5
```

We can show that the tag coefficient is not applied when more than one tag exists on a task.

To see the problem in action create a `taskrc` file with the above config in an empty directory and run the following commands:

```sh
# Create task with one tag and now additional urgency
$ task rc:taskrc add Test +baz
TASKRC override: taskrc
Created task 1.

# Show list of tasks where urgency is as expected
$ task rc:taskrc
TASKRC override: taskrc

ID Age Tag Description Urg
1 14s baz Test 0.8

1 task

# Add tag bar, expecting the urgency to go up
$ task rc:taskrc 1 modify +bar
Modifying task 1 'Test'.
Modified 1 task.
TASKRC override: taskrc
$ task rc:taskrc
TASKRC override: taskrc

ID Age Tag Description Urg
1 2min bar baz Test 0.9

1 task

# Show task 1 (With non-important part stripped out) - urgency did not go up
$ task rc:taskrc 1
TASKRC override: taskrc

Name Value
ID 1
Urgency 0.9
[tag_bar x]
[tag_baz x]

tags 0.9 * 1 = 0.9
------
0.9

# Remove tag baz, so only one tag with a coefficient is present
$ task rc:taskrc 1 modify -baz
Modifying task 1 'Test'.
Modified 1 task.
TASKRC override: taskrc

# Show task 1 (With non-important part stripped out) - urgency is as expected
$ task rc:taskrc 1
TASKRC override: taskrc

Name Value
ID 1
Urgency 5.8
[tag_bar x]

tags 0.8 * 1 = 0.8
UDA tags.bar 1 * 5 = 5
------
5.8

# Add second tag with coefficient - expecting urgency to be 15+
$ task rc:taskrc 1 modify +foo
Modifying task 1 'Test'.
Modified 1 task.
TASKRC override: taskrc

# Show task 1 (With non-important part stripped out) - urgency is incorrect
$ task rc:taskrc 1
TASKRC override: taskrc

Name Value
ID 1
Description Test
Status Pending
Entered 2024-12-17 13:54:58 (7min)
Last modified 2024-12-17 14:01:53 (21s)
Tags bar foo
Virtual tags LATEST PENDING READY TAGGED UNBLOCKED
UUID 6cac55d8-89da-440d-b8e7-1aa676963fe5
Urgency 0.9
[tag_bar x]
[tag_foo x]

tags 0.9 * 1 = 0.9
------
0.9
```

Output of `task diag`

```
$ task rc:taskrc diag
TASKRC override: taskrc

task 3.1.0
Platform: Darwin

Compiler
Version: Apple LLVM 16.0.0 (clang-1600.0.26.3)
Caps: +stdc +stdc_hosted +LP64 +c8 +i32 +l64 +vp64 +time_t64
Compliance: C++17

Build Features
CMake: 3.30.3
libuuid: libuuid + uuid_unparse_lower
Build type: Release

Configuration
File: taskrc (found), 149 bytes, mode 100644
Data: . (found), dir, mode 40755
GC: Enabled
$EDITOR: hx
Hooks
System: Enabled
Location: ./hooks
(-none-)

Tests
Terminal: 252x75
Broken ref: Scanned 2 tasks for broken references:
No broken references found
```

As a sidenote: My terminal is 170x61 and not 252x75 as seen in the diag output.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.