diff options
| -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 |
