From 19fbf0cd25b7db54cbafc18658364a69fa0983a8 Mon Sep 17 00:00:00 2001 From: Zack Hobson Date: Tue, 19 Nov 2013 11:21:35 -0800 Subject: stop: Check for running timers from yesterday. --- lib/hcl/commands.rb | 2 +- lib/hcl/day_entry.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/hcl/commands.rb b/lib/hcl/commands.rb index 38f7ab1..00ab7b1 100644 --- a/lib/hcl/commands.rb +++ b/lib/hcl/commands.rb @@ -63,7 +63,7 @@ module HCl end def stop *args - entry = DayEntry.with_timer + entry = DayEntry.with_timer || DayEntry.with_timer(DateTime.yesterday) if entry entry.append_note(args.join(' ')) if args.any? entry.toggle diff --git a/lib/hcl/day_entry.rb b/lib/hcl/day_entry.rb index 84b5e3d..6237fea 100644 --- a/lib/hcl/day_entry.rb +++ b/lib/hcl/day_entry.rb @@ -36,8 +36,8 @@ module HCl %{#{notes}#{hours}} end - def self.with_timer - all.detect {|t| t.running? } + def self.with_timer date=nil + all(date).detect {|t| t.running? } end def self.last_by_task project_id, task_id -- cgit v1.2.3