lib/timetrap/helpers.rb in samg-timetrap-0.1.0 vs lib/timetrap/helpers.rb in samg-timetrap-0.1.1
- old
+ new
@@ -33,9 +33,10 @@
secs = entries.inject(0){|m, e|e_end = e.end || Time.now; m += e_end.to_i - e.start.to_i if e_end && e.start;m}
"%2s:%02d:%02d" % [secs/3600, (secs%3600)/60, secs%60]
end
def sheet_name_from_string string
+ return "all" if string =~ /^\W*all\W*$/
return "" unless string =~ /.+/
DB[:entries].filter(:sheet.like("#{string}%")).first[:sheet]
rescue
""
end