GothenburgBitFactory / bugwarrior

Pull github, bitbucket, and trac issues into taskwarrior
http://pypi.python.org/pypi/bugwarrior
GNU General Public License v3.0
732 stars 209 forks source link

Handle redmine not returning estimated hours. #967

Closed fedegiova closed 1 year ago

fedegiova commented 1 year ago

In our setup the estimated_hours and spent_hours fields might be empty, this trigger an exception in taskwarrior that it cannot convert 0.0 to a duration.

ERROR:bugwarrior.db:Unable to add task: b"The duration value '0.0' is not supported." Traceback (most recent call last): File "/usr/lib/python3.10/site-packages/bugwarrior/db.py", line 439, in synchronize new_task = tw.task_add(*issue) File "/usr/lib/python3.10/site-packages/taskw/warrior.py", line 704, in task_add stdout, stderr = self._execute('add', args) File "/usr/lib/python3.10/site-packages/taskw/warrior.py", line 498, in _execute

The command line for taskwarrior invocation is:

[b'task' ... b'rc.uda.redminespenthours.type=duration', b'rc.uda.redminespenthours.label="Redmine Spent Hours"', b'rc.uda.redmineestimatedhours.type=duration', ... b'redminespenthours:"0.0"' ]

The patch makes sure that the value is formatted correctly for the duration type

fedegiova commented 1 year ago

You're right, I'll test your fix in a couple of days and I'll upload a new patch if it works.

Thanks Federico

fedegiova commented 1 year ago

Hi! I've tested your solution and it's working fine, it fix the previous problem and also correctly update the task database.

I've reverted mine and applied your modifications.

Regards Federico