taskwarrior
taskwarrior copied to clipboard
Format of numeric UDAs in report changed
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:
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
I suspect this is due to the export/import process -- can you check whether newly-added tasks still have the zeroes for this field?
good guess, here's a newly created task:
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 ...
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: )
Nice! Any chance you could include an edited-down, redacted version of a line or two of your task export output?
Nice! Any chance you could include an edited-down, redacted version of a line or two of your
task exportoutput?
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)
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?
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!