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

Can not add `totalactivetime` to any report #10

Closed mmynsted closed 9 years ago

mmynsted commented 9 years ago

I would like to add this value to the list report. I updated the ~/.taskrc file as follows.

uda.totalactivetime.type=duration
uda.totalactivetime.label=Total Active Time
report.list.columns=id,project,priority,due,start.active,entry.age,totalactivetime,description
report.list.labels=ID,Proj,Pri,Due,Active,Age,Worked,Description

The totalactivetime UDA is completely ignored. How can I add this to a report?

coddingtonbear commented 9 years ago

I'm not sure what report (if any) report.list is wired-up to, honestly, but as discussed in the #taskwarrior channel on IRC, this functionality works exactly as described if you use report.all and/or report.next.

Good luck!

mmynsted commented 9 years ago

You got it to work for some versionOne column. Did you try using the taskwarrior-time-tracking-hook? This did not work for me.

Still does not work

This issue should be open unless you can get this work work with taskwarrior-time-tracking-hook's totalactivetime.

~/.taskrc modifications for reporting

Here is an example of content from ~/.taskrc.

uda.totalactivetime.type=duration
uda.totalactivetime.label=Total Active Time

#list report
report.list.columns=id,project,priority,due,start.active,entry.age,totalactivetime,description
report.list.labels=ID,Proj,Pri,Due,Active,Age,Worked,Description

#next report
report.next.columns=id,project,priority,due,start.active,entry.age,urgency,totalactivetime,description
report.next.labels=ID,Proj,Pri,Due,A,Age,Urg,Worked,Description

#all report
report.all.columns=id,status,project,priority,due,end,start.active,entry.age,totalactivetime,description
report.all.labels=ID,Status,Proj,Pri,Due,Completed,Active,Age,Worked,Description

Demonstration that the ~/.taskrc changes are being read

Here is an example of dumping the applicable configuration items to the console.

$ task show |grep -e 'uda' -e 'report.all' -e 'report.list' -e 'report.next'
report.all.columns              id,status,project,priority,due,end,start.active,entry.age,totalactivetime,description
report.all.description          Lists all pending and completed tasks
report.all.filter               status.not:deleted
report.all.labels               ID,Status,Proj,Pri,Due,Completed,Active,Age,Worked,Description
report.all.sort                 entry+
report.list.columns             id,project,priority,due,start.active,entry.age,totalactivetime,description
report.list.description         Lists all pending tasks
report.list.filter              status:pending
report.list.labels              ID,Proj,Pri,Due,Active,Age,Worked,Description
report.list.sort                due+,priority-,start-,project+
report.next.columns             id,project,priority,due,start.active,entry.age,urgency,totalactivetime,description
report.next.description         Lists the most urgent tasks
report.next.filter              status:pending limit:page
report.next.labels              ID,Proj,Pri,Due,A,Age,Urg,Worked,Description
report.next.sort                urgency-,due+,priority-,start-,project+
rule.precedence.color           due.today,active,blocking,blocked,overdue,due,scheduled,keyword.,project.,tag.,uda.,recurring,pri.,tagged,completed,deleted
uda.totalactivetime.label       Total Active Time
uda.totalactivetime.type        duration
uda.totalactivetime.values

Showing the detail of a task with totalactivetime.

Here is a detail of task 2 showing that it has a value for the Total Active Time.

$ task 2 info

Name          Value
ID            2
Description   project:test Test using task warrior for time tracking
Status        Pending
UUID          f4c37208-2591-4918-a2ea-10bd2d172262
Entered       2015-02-04 15:08:23 (5 hrs)
Urgency       0
Last modified 2015-02-04 15:48:24 (4 hrs)

Date                Modification
2015-02-04 15:12:30 Modified set to '2015-02-04 15:12:30'.
                    Start set to '2015-02-04 15:12:30'.
2015-02-04 15:16:48 Start deleted (duration: 0:04:18).
                    Modified changed from '2015-02-04 15:12:30' to '2015-02-04 15:16:48'.
2015-02-04 15:26:36 Start set to '2015-02-04 15:26:36'.
                    Modified changed from '2015-02-04 15:16:48' to '2015-02-04 15:26:36'.
2015-02-04 15:48:24 Start deleted (duration: 0:21:48).
                    Modified changed from '2015-02-04 15:26:36' to '2015-02-04 15:48:24'.
Total active time   0:26:06

Notice the value 0:26:06.

Showing reports

Now lets try each of the modified reports.

list report

$ task 2 list

ID Age Description
 2 5h  project:test Test using task warrior for time tracking

1 task

next report

$ task 2 next

ID Age Urg  Description
 2 5h     0 project:test Test using task warrior for time tracking

1 task

all report

$ task 2 all

ID Status  Age Description
 2 Pending 5h  project:test Test using task warrior for time tracking

1 task

Showing all defined udas

 task udas

Name            Type     Label             Allowed Values Default Usage Count
totalactivetime duration Total Active Time                        0

1 UDA defined

It looks to me like the totalactivetime is not part of a task and so can not be made part of the reports. I do not know how to fix this.

Task export showing totalactivetime not part of task that shows the value in info

Here is an export of task 2, that has the totalactivetime as shown when getting info about the task.

$ task 2 export
{"id":2,"description":"project:test Test using task warrior for time tracking","entry":"20150204T210823Z","modified":"20150204T214824Z","status":"pending","uuid":"f4c37208-2591-4918-a2ea-10bd2d172262","urgency":"0"}