GothenburgBitFactory / tasklib

A Python library for interacting with taskwarrior databases.
http://tasklib.readthedocs.org/en/latest/
BSD 3-Clause "New" or "Revised" License
147 stars 28 forks source link

Added _get_task_attrs method to backend #50

Closed lyz-code closed 4 years ago

lyz-code commented 6 years ago

Hi, I'm adding the feature of being able to parse the history of taskwarrior (through the undo.data).

One application of this feature that I'm also writing is the ability to measure the total time spent on tasks, without the ugly hack of adding an annotation each time you start or stop a task. That info is already in the undo.data.

So, instead of a huge MR I'm splitting it to be somewhat edible :)

I need this method to parse the available task attributes of the undo.data file.

I've also added a minimum support of UDAs detection of the config, it doesn't solve issue #30 but it's a start.

Cheers

coveralls commented 6 years ago

Coverage Status

Coverage increased (+0.1%) to 91.72% when pulling 10e2f0367d8591827a879e854cb8c6d405c829b7 on lyz-code:feature/get_task_attributes into 79e9a98f7ca33cf4e282dfcfdf132b6f0b0995a9 on robgolding:develop.

jamatute commented 6 years ago

Hi @robgolding, is there anything I can do to help with the review of the Pull request?

robgolding commented 6 years ago

Sorry for the delay, I'll go over this now.

lyz-code commented 6 years ago

I didn't want to make a huge PR, instead I'll do several small ones to make it bearable :).

That's why this may seem a little bit out of context.

I need this method because the undo.data file has lines with the following format:

time 1508839796
new [description:"Create ansible playbook to deploy backupninja" entry:"1482393062" est:"1.000000" modified:"1486571719" priority:"L" project:"sis" status:"pending" tags:"ansible" uuid:"22a0a917-923b-48a0-a20f
-f08e2eca119a"]
---

I need to know the available task attributes and udas to convert that format to json to be able to load it into a dictionary. I saw this way of doing things better than accepting any word:" regexp

for key in self.backend.available_task_attrs:
    ... process the data_line ...

history_entry = json.loads(data_line)

You can find the whole code here under the TaskHistory class, method _convert_history_entry

lyz-code commented 6 years ago

@robgolding Seems that the SCM of travis is broken again

robgolding commented 6 years ago

I'd prefer to see all the changes in context @lyz-code, so one big PR is probably preferable here actually.

Also I need to fix the Git repo location now taskwarrior has moved to GitHub!

lyz-code commented 4 years ago

Closing for inactivity