Project

trs24

0.0
No commit activity in last 3 years
No release in over 3 years
Accepts a list of activty times and returns a summary of activity duration.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 1.8, >= 1.8.27
~> 0.5, >= 0.5.7
~> 0.8, >= 0.8.3
 Project Readme

Introducing the Trs24 gem

require 'trs24'

activities = "
drying dishes # 10:09 # 10:12
dishes        # 10:19 # 10:21
drying dishes # 10:22 # 10:26
dishes        # 10:27 # 10:33
lunch         # 12:13 # 13:20
dev           # 13:39 # 16:41
"

lookup = "
drying dishes #housework #kitchen #chores
dishes #housework #kitchen #chores
housework #chores
kitchen #housework
dev #SoftwareDevelopment
lunch #meal
breakfast #meal
teatime | dinner | meal | mealtime #meal
microblog #dev
sleep |sleeping | bed time | in bed #sleep
washed and dressed #tasks #personal
personal #tasks
chores #tasks
bath | bathing #tasks #personal
"

a = activities.strip.lines.map do |line| 
  s, t1, t2 = line.split(/ +# +/,3); 
  [s, Time.parse(t1), Time.parse(t2)]
end

trs = Trs24.new(lookup, a, debug: false)
trs.summary #=> {"SoftwareDevelopment"=>"3h 2m", "meal"=>"1h 7m", "tasks"=>"15m"} 

In the above example the number of total hours for each activity is summarised, grouped by the associated top-level hashtag.

Resources

trs trs24 gem timerecordingsystem activitylogger reporting report