lib/timetrap/formatters/text.rb in timetrap-1.8.7 vs lib/timetrap/formatters/text.rb in timetrap-1.8.8

- old
+ new

@@ -9,10 +9,11 @@ sheets = entries.inject({}) do |h, e| h[e.sheet] ||= [] h[e.sheet] << e h end + longest_note = entries.inject('Notes'.length) {|l, e| [e.note.rstrip.length, l].max} (sheet_names = sheets.keys.sort).each do |sheet| self.output << "Timesheet: #{sheet}\n" id_heading = Timetrap::CLI.args['-v'] ? 'Id' : ' ' self.output << "#{id_heading} Day Start End Duration Notes\n" last_start = nil @@ -34,19 +35,15 @@ from_current_day = [] else end last_start = e.start end - self.output << <<-OUT - --------------------------------------------------------- - OUT + self.output << " %s\n" % ('-'*(52+longest_note)) self.output << " Total%43s\n" % format_total(sheets[sheet]) self.output << "\n" unless sheet == sheet_names.last end if sheets.size > 1 - self.output << <<-OUT -------------------------------------------------------------- - OUT + self.output << "%s\n" % ('-'*(4+52+longest_note)) self.output << "Grand Total%41s\n" % format_total(sheets.values.flatten) end end end end