diff options
| author | Zack Hobson | 2009-07-30 10:30:59 -0700 |
|---|---|---|
| committer | Zack Hobson | 2009-07-30 10:30:59 -0700 |
| commit | 31a3a51bf078cb771dbdf44985a1f4e9121ff5c4 (patch) | |
| tree | eb75f8d9153b6dbc853a9c3b9f62677824c162e4 /lib/hcl.rb | |
| parent | 711945bc67f2787e2d2d06b75989eadb503ae810 (diff) | |
| download | hcl-31a3a51bf078cb771dbdf44985a1f4e9121ff5c4.tar.bz2 | |
Always display hours as HH:MM, closes #22.
Diffstat (limited to 'lib/hcl.rb')
| -rw-r--r-- | lib/hcl.rb | 10 |
1 files changed, 2 insertions, 8 deletions
@@ -213,17 +213,11 @@ EOM total_hours = 0.0 DayEntry.all(date).each do |day| running = day.running? ? '(running) ' : '' - puts "\t#{as_hours day.hours}\t#{running}#{day.project} #{day.notes}"[0..78] + puts "\t#{day.formatted_hours}\t#{running}#{day.project} #{day.notes}"[0..78] total_hours = total_hours + day.hours.to_f end puts "\t" + '-' * 13 - puts "\t#{as_hours total_hours}\ttotal" - end - - # Convert from decimal to a string of the form HH:MM. - def as_hours hours - minutes = hours.to_f * 60.0 - sprintf "%d:%02d", (minutes / 60).to_i, (minutes % 60).to_i + puts "\t#{HCl::DayEntry.as_hours total_hours}\ttotal" end end |
