Bug 215783

Summary: allow exporting event history
Product: [Applications] ktimetracker Reporter: Thorsten Staerk <dev>
Component: generalAssignee: Zoltan Gyarmati <mr.zoltan.gyarmati>
Status: REOPENED ---    
Severity: wishlist CC: alavarre, aspotashev, hoffmann, mr.zoltan.gyarmati
Priority: NOR Keywords: junior-jobs
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Thorsten Staerk 2009-11-23 09:00:48 UTC
Version:            (using Devel)
OS:                Linux
Installed from:    Compiled sources

In ktimetracker you have a menu item file->edit history. This shows you all events. An event contains of a task, when you started working on it, when you finished working on it, and an optional comment.

It should be possible to export this list to CSV, please add an "export" button.

JUNIOR JOB
Comment 1 Dirk Hoffmann 2010-01-26 22:02:07 UTC
This is a ten-liner in awk (1), using ktimetracker.ics. I would suggest to downgrade the priority for this job to minor or trival.

Just my two pennies ...
Comment 2 Thorsten Staerk 2010-01-26 22:12:57 UTC
Yes I created this bug report because I was asked for junior jobs, feeding for newcomers to give them some kind of confidence. Although easy to do it would allow for automated programs showing to you what you did when. High-priority for those who want it :)

I am not working on this bug, but looking for a newcomer to implement it.
Comment 3 Andy Lavarre 2011-04-05 16:33:11 UTC
If it is only a ten liner in awk I'll be glad to take a whack at it, but where to start, where to access the report? 

Transforming the ics into this format is NOT trivial. Nor is RFC 2445!

I agree with tstaerk: High-priority for those who want it.

My full take is at
     http://tinyurl.com/3cdxw6x

TIA, Andy
Comment 4 Dirk Hoffmann 2011-04-11 20:55:37 UTC
Sorry, I did not realise immediately that this was referring to my comment of last year. 

The KARM data (ICS file) used to be in
 $HOME/.kde/share/apps/karm/karm.ics,
where as KTIMETRACKER allows usage of several ICS files. But typically it would be found in
 /.kde/share/apps/ktimetracker/ktimetracker.ics
by default, unless you configured it otherwise.

The format has become a bit inconsequent with the renaming of the package (karm->ktt), indeed: Coexistence of X-KDE-karm-totalTaskTime and 
X-KDE-ktimetracker-sessionStartTiMe (yes, capital M!) and the like, use of timezones (which is pointless, if you think about it).

But for the task described above - CSV of task, start, end, comment - the awk code is far below 10 lines. The trickiest part is probably to remove the duplicate \r\n sequence (although not essential):

awk -F : '/^DTSTART/||/^DTEND/ {printf "%s,", $2} /^SUMMARY/ {printf "\"%s\",", $2} /^COMMENT/ {c=$2} /END:VEVENT/ {print c; c=""}' $KARMFILE | tr -d '\015'
# Set $KARMFILE to the appropriate filename.

Sure, this is not 100% foolproof, although I do not see an obvious source of failure, unless the order of items in the ICS file changes, which is a matter of stable ktt code.
Comment 5 Zoltan Gyarmati 2014-12-03 03:04:25 UTC
Submitted a patch for this via reviewboard (see https://git.reviewboard.kde.org/r/121334/diff/#)
which resolves this within ktimetracker. Please feel free to comment here or there
Comment 6 Andrew Crouthamel 2018-09-04 18:54:14 UTC
Hello! Sorry to be the bearer of bad news, but this project has been unmaintained for many years so I will be closing this bug.