You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by ru...@apache.org on 2018/03/26 01:38:51 UTC

[whimsy] branch master updated: indicate which reports got feedback

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 db9db98  indicate which reports got feedback
db9db98 is described below

commit db9db9825e483b2a9e28e568657093c25e8bbbb8
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Sun Mar 25 21:38:26 2018 -0400

    indicate which reports got feedback
---
 www/board/agenda/routes.rb                       |  5 +++++
 www/board/agenda/views/actions/responses.json.rb | 24 ++++++++++++++++++++++++
 2 files changed, 29 insertions(+)

diff --git a/www/board/agenda/routes.rb b/www/board/agenda/routes.rb
index ea63dc9..a65d96e 100755
--- a/www/board/agenda/routes.rb
+++ b/www/board/agenda/routes.rb
@@ -229,6 +229,11 @@ get %r{/(\d\d\d\d-\d\d-\d\d)} do |date|
   redirect to("/#{date}/")
 end
 
+# feedback responses 
+get '/json/responses' do
+  _json :"actions/responses"
+end
+
 # posted reports
 get '/json/posted-reports' do
   _json :"actions/posted-reports"
diff --git a/www/board/agenda/views/actions/responses.json.rb b/www/board/agenda/views/actions/responses.json.rb
new file mode 100644
index 0000000..0afb43c
--- /dev/null
+++ b/www/board/agenda/views/actions/responses.json.rb
@@ -0,0 +1,24 @@
+require 'date'
+
+maildir = '/srv/mail/board/'
+start = maildir + (Date.today - 365).strftime("%Y%m")
+
+responses = {}
+
+Dir[maildir + '*'].sort.each do |dir|
+  next unless dir >= start
+  Dir[dir.untaint + '/*'].each do |msg|
+    text = File.open(msg.untaint, 'rb') {|file| file.read}
+    subject = text[/^Subject: .*/]
+    next unless subject and subject =~ /Board feedback on .* report/
+    date, pmc = subject.scan(/Board feedback on ([-\d]+) (.*) report/).first
+    next unless date
+    responses[date] ||= []
+    unless responses[date].include? pmc
+      responses[date].push pmc
+    end
+  end
+end
+
+responses.values.each {|value| value.sort!}
+responses.sort.to_h

-- 
To stop receiving notification emails like this one, please contact
rubys@apache.org.