summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/hcl/commands.rb2
-rw-r--r--lib/hcl/day_entry.rb4
2 files changed, 3 insertions, 3 deletions
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
%{<request><notes>#{notes}</notes><hours>#{hours}</hours></request>}
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