(Minor report format update; include monthly totals column.) master
authorChris Jaekl <chris@localhost>
Thu, 16 Feb 2023 05:33:15 +0000 (00:33 -0500)
committerChris Jaekl <chris@localhost>
Thu, 16 Feb 2023 05:33:15 +0000 (00:33 -0500)
lib/report.rb

index 45a981f8e60fc3891b684a28a6a0a9bb9dea75cd..0f538357c9c765ed26b67ebfc723144ccddf59be 100644 (file)
@@ -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