kostajh / taskwarrior-time-tracking-hook

A simple Taskwarrior hook allowing one to track total time spent on a task.
137 stars 24 forks source link

Does it work with taskwarrior 2.5 and python 2.7? #13

Closed vonpupp closed 8 years ago

vonpupp commented 8 years ago

Hello,

I'm using taskwarrior 2.5 and python 2.7.10. I just installed your package via pip2 on archlinux as:

pip2 install git+https://github.com/kostajh/taskwarrior-time-tracking-hook.git

It installed just fine:

(bin2)[av:...epos/dotfiles-task/home/bin]$ pip freeze
ansible==1.9.4
arandr==0.1.8
argcomplete==1.0.0
...
taskw==1.1.0
taskwarrior-time-tracking-hook==0.1.4

I created the UDAs as on the readme:

uda.estimate.type=numeric
uda.estimate.label=Estimate

uda.totalactivetime.type=duration
uda.totalactivetime.label=Active time
uda.totalactivetime.values=

I added a test task (ID=38) and when I query for the estimate it works fine:

(bin2)[av:...epos/dotfiles-task/home/bin]$ t 38
No command specified - assuming 'information'.

Name          Value                                     
ID            38
Description   test task                                 
Status        Pending
Entered       2015-11-16 23:45:47 (39min)               
Last modified 2015-11-17 00:25:16 (3s)
Tags          in                                        
Virtual tags  PENDING READY TAGGED UDA UNBLOCKED LATEST
UUID          5a7d80a5-25c2-4d6e-91cf-6c893a476044      
Urgency        0.8
Estimate      30                                        

    tags    0.8 *    1 =    0.8
                         ------
                            0.8

Date                Modification                       
2015-11-16 23:46:45 Start set to '2015-11-16 23:46:45'.
2015-11-16 23:49:40 Start deleted (duration: PT2M55S). 
2015-11-16 23:52:10 Estimate set to '30'.
2015-11-17 00:23:42 Start set to '2015-11-17 00:23:42'.
2015-11-17 00:25:16 Start deleted (duration: PT1M34S).

I created a simple report with real vs estimated time as:

report.estimatedone.description = REAL vs ESTIMATED time
report.estimatedone.columns     = id,totalactivetime,estimate,description.desc
report.estimatedone.filter      = (status:waiting or status:pending)
report.estimatedone.labels      = ID,RT,ET,Desc
report.estimatedone.sort        = priority-,urgency-

When I task _get 38.totalactivetime I get no value (blank), I don't get an error though. And when I task estimatedone, I don't get the totalactivetime column. I started the task 38 for about 2 min several times

I tried to place an ipdb breakpoint after line 21, on /home/av/.venv/bin2/lib/python2.7/site-packages/taskwarrior_time_tracking_hook (my python2 virtualenv) however it doesn't show any console.

Is this package made for python2 or python3? Any idea what am I doing wrong?

Thanks you very much!

coddingtonbear commented 8 years ago

Hey there @vonpupp -- looking at the above, you don't mention adding it to your taskwarrior hooks? Did you do that?

vonpupp commented 8 years ago

Hello @coddingtonbear.

Thanks for your answer! You mean ln -swhich taskwarrior_time_tracking_hook~/.task/hooks/on-modify.timetracking, right? Sorry, I forgot to mention that. Yes I did that also:

[av:~/.task/hooks]$ ls -la
total 0
lrwxrwxrwx 1 av av 54 Nov 16 23:33 on-modify.timetracking -> /home/av/.venv/bin2/bin/taskwarrior_time_tracking_hook

What surprises me the most is that the ipdb breakpoint is not working, so I cannot figure what is happening.

coddingtonbear commented 8 years ago

If it isn't hitting your ipdb, it sounds like Taskwarrior might not be running the hook. If I were you, I'd double-check with the friendly folks in the #taskwarrior channel on Freenode -- they might have some ideas!

coddingtonbear commented 8 years ago

Incidentally -- thanks for the very-detailed report above; it's really pretty fantastic :-)

vonpupp commented 8 years ago

Thanks for your help @coddingtonbear. I will try to get help on IRC =). Does your package run fine on both Python 2 and 3?

coddingtonbear commented 8 years ago

Oh, it definitely runs on Python 2, and (after briefly glancing) probably runs on Python 3. I haven't personally used this hook in a year or so, so I can't say with any real certainty.

vonpupp commented 8 years ago

Dear @coddingtonbear

I found the problem with the help of the #taskwarrior folks. My data.location is not standard (data.location=~/.task/data on the .taskrc file), so I just had to symlink to ~/.task/data/hooks/on-modify.timetracking instead of ~/.task/hooks/on-modify.timetracking as it is on the documentation. My bad, sorry.

An interesting tip from the #taskwarrior guys that helped to figure that out was the task diagnostics command. When the path was wrong it couldn't find the hook. This worth noticing just for the sake of knowledge :)

Thanks again for your help.