From: Chris Jaekl Date: Thu, 16 Feb 2023 05:33:15 +0000 (-0500) Subject: (Minor report format update; include monthly totals column.) X-Git-Url: https://jaekl.net/gitweb/?a=commitdiff_plain;ds=inline;p=oct_sched.git (Minor report format update; include monthly totals column.) --- diff --git a/lib/report.rb b/lib/report.rb index 45a981f..0f53835 100644 --- a/lib/report.rb +++ b/lib/report.rb @@ -15,7 +15,7 @@ class Report totals = add_month(totals: totals, filename: filename) end - headers = ["Month"] + headers = ["Month", "Total"] routes = totals.keys.reject{|x| x.is_a? Symbol}.sort_by(&:to_i) headers.append(routes) @@ -24,12 +24,14 @@ class Report values = @monthly_totals[month] puts [ "#{values[:year]}-#{values[:month]}", + values[:sum].to_s, routes.map{|route| values[route] || ""}, ].flatten.join(";") end puts [ "TOTAL", + totals[:sum].to_s, routes.map{|route| totals[route] || ""}, ].flatten.join(";") end