taskwarrior icon indicating copy to clipboard operation
taskwarrior copied to clipboard

Format of numeric UDAs in report changed

Open jkaiser-ioki opened this issue 1 year ago • 7 comments
trafficstars

Issue appeared with upgrade to taskwarrior 3.0.0

I have a custom UDA defined like this:

uda.size.type=numeric
uda.size.label=Size
uda.size.values=1,2,3,5,8,13,21

I added the column to my next report:

report.next.labels=ID,Active,Age,Deps,P,Project,Tag,Recur,Sched,Due,Until,Size,Description,Urg
report.next.columns=id,start.age,entry.age,depends,priority,project,tags,recur,scheduled.countdown,due.relative,until.remaining,size,description,urgency

When I run task to get the next report, the "Size" column shows up as expected, but its values are now displayed as floating point numbers with six digits after the decimal point, rather than as integers: image

This is not critical, but widens the rendering of the table unnecessarily. I guess it would be nice if it were either possible to declare the UDA type more specifically as int vs float, or to at least have a possibility to format the rendering of a particular column somehow.

I guess the behaviour is due to the changed backend somehow and the internal representation of the values

jkaiser-ioki avatar Mar 28 '24 09:03 jkaiser-ioki

I suspect this is due to the export/import process -- can you check whether newly-added tasks still have the zeroes for this field?

djmitche avatar Mar 28 '24 12:03 djmitche

good guess, here's a newly created task:

image

and using something like task 116 mod size:5 also fixes that particular task ...

question: is there a simple solution that modfies all tasks in one batch run ...

jkaiser-ioki avatar Apr 03 '24 14:04 jkaiser-ioki

ok, doing something like this

[jonas@orchid ~]$ task size:8 mod size:8
This command will alter 111 tasks.
  - Size will be changed from '8.000000' to '8'.

for all the allowed values in size seems to do the trick (fortunately it is only a handful of possible values :sweat_smile: )

jkaiser-ioki avatar Apr 03 '24 14:04 jkaiser-ioki

Nice! Any chance you could include an edited-down, redacted version of a line or two of your task export output?

djmitche avatar Apr 04 '24 01:04 djmitche

Nice! Any chance you could include an edited-down, redacted version of a line or two of your task export output?

I don't believe that will be possible, since I deleted the exported file after "successful" import (and it wasn't captured by by backup routine either :see_no_evil: ). And also the original storage files in the .task directory (as suggested by the migration instructions)

jkaiser-ioki avatar Apr 04 '24 11:04 jkaiser-ioki

Bummer!

3.0 didn't really change the task import / task export implementations, but it has certainly encouraged more people to run them, and I think we're finding some of the "edge cases" where values don't survive the round trip. One thing I didn't realize is that the format of the export depends on the type of UDAs, so a numeric UDA is exported as a JSON number, despite being stored as a string internally to Taskwarrior.

Based on that information, maybe someone can cook up a reproduction recipe for this?

djmitche avatar Apr 04 '24 18:04 djmitche

Forgot to add: I'm not prioritizing this because I think the bug here is in the export, so a fix in 3.0 won't actually help users transitioning to 3.0. We should still fix the bug though, and a repro recipe will help!

djmitche avatar Apr 04 '24 18:04 djmitche