diff options
| author | Zack Hobson | 2009-07-30 10:23:41 -0700 |
|---|---|---|
| committer | Zack Hobson | 2009-07-30 10:23:41 -0700 |
| commit | 711945bc67f2787e2d2d06b75989eadb503ae810 (patch) | |
| tree | 225985fa11d88620a68112e3041f4370bc18d85a /lib | |
| parent | d0b0483311a0838b92b9757ca1648e3410f2cb72 (diff) | |
| download | hcl-711945bc67f2787e2d2d06b75989eadb503ae810.tar.bz2 | |
Do not write empty task cache, this may affect #23.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/hcl.rb | 1 | ||||
| -rw-r--r-- | lib/hcl/task.rb | 10 |
2 files changed, 7 insertions, 4 deletions
@@ -212,7 +212,6 @@ EOM date = args.empty? ? nil : Chronic.parse(args.join(' ')) total_hours = 0.0 DayEntry.all(date).each do |day| - # TODO more information and formatting options running = day.running? ? '(running) ' : '' puts "\t#{as_hours day.hours}\t#{running}#{day.project} #{day.notes}"[0..78] total_hours = total_hours + day.hours.to_f diff --git a/lib/hcl/task.rb b/lib/hcl/task.rb index 5923867..e5dc267 100644 --- a/lib/hcl/task.rb +++ b/lib/hcl/task.rb @@ -8,8 +8,10 @@ class HCl new xml_to_hash(task).merge(:project => project) end) end - File.open(File.join(ENV['HOME'],'.hcl_tasks'), 'w') do |f| - f.write tasks.uniq.to_yaml + unless tasks.empty? + File.open(File.join(ENV['HOME'],'.hcl_tasks'), 'w') do |f| + f.write tasks.uniq.to_yaml + end end end @@ -18,7 +20,9 @@ class HCl end def self.find project_id, id - all.detect {|t| t.project.id == project_id && t.id == id } + all.detect do |t| + t.project.id.to_i == project_id.to_i && t.id.to_i == id.to_i + end end def to_s |
