Created
September 8, 2013 12:02
-
-
Save berkes/6484228 to your computer and use it in GitHub Desktop.
Quick-n-dirty import of hamster time tracking (https://projecthamster.wordpress.com) into timetrap (https://github.com/samg/timetrap).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "sqlite3" | |
hamster = SQLite3::Database.new ".local/share/hamster-applet/hamster.db" | |
timetrap = SQLite3::Database.new ".timetrap.db" | |
unparsed = hamster.execute("select * from facts inner join activities on activities.id = facts.activity_id inner join categories on categories.id = activities.category_id") | |
entries = unparsed.map do |e| | |
timetrap.execute("insert into entries (note, start, end, sheet) values (?, ?, ?, ?)", | |
"#{e[6]} #{e[4]}", | |
e[2], | |
e[3]||e[2], #avoid errors turning into running time-entries | |
e[13]||"no-sheet") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment