whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ru...@apache.org
Subject [whimsy] branch master updated: handle DateTime headings; add debug support
Date Sat, 11 Mar 2017 03:07:16 GMT
This is an automated email from the ASF dual-hosted git repository.

rubys pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git

The following commit(s) were added to refs/heads/master by this push:
       new  b6df158   handle DateTime headings; add debug support
b6df158 is described below

commit b6df1587e78e4b612a801600e28743faac88efa6
Author: Sam Ruby <rubys@intertwingly.net>
AuthorDate: Fri Mar 10 22:06:59 2017 -0500

    handle DateTime headings; add debug support
---
 www/board/agenda/views/actions/financials.json.rb | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/www/board/agenda/views/actions/financials.json.rb b/www/board/agenda/views/actions/financials.json.rb
index 1919ba2..ea4f6c6 100644
--- a/www/board/agenda/views/actions/financials.json.rb
+++ b/www/board/agenda/views/actions/financials.json.rb
@@ -8,6 +8,9 @@ require 'rubyXL'
 require 'active_support'
 require 'active_support/core_ext/numeric/conversions'
 
+# for debugging purposes; read spreadsheet from file if run from command line
+@spreadsheet = Base64.encode64(File.read(ARGV.first)) if __FILE__ == $0
+
 # parse worksheet
 # https://github.com/weshatheleopard/rubyXL/issues/235
 begin
@@ -52,7 +55,10 @@ rows.shift(2)
 # move headings from second to seventh row
 headings = rows.delete_at(1)
 headings[2] = headings[6] = 'Budget'
-1.upto(7) {|i| headings[i] = headings[i].rjust(12) if headings[i]}
+1.upto(7) do |i|
+  headings[i] = headings[i].strftime("%b-%y") if DateTime === headings[i]
+  headings[i] = headings[i].rjust(12) if headings[i]
+end
 rows.insert(6, headings)
 
 # delete empty rows
@@ -76,4 +82,7 @@ rows.each do |row|
   end
 end
 
+# print output to stdout if run from the command line
+puts output if __FILE__ == $0
+
 {table: output.join("\n")}

-- 
To stop receiving notification emails like this one, please contact
['"commits@whimsical.apache.org" <commits@whimsical.apache.org>'].

Mime
View raw message