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  f42d7d3   scan for feedback emails requiring followup
f42d7d3 is described below

commit f42d7d3a933655d273bcf2a71ab838d1f5aa24ff
Author: Sam Ruby <[email protected]>
AuthorDate: Mon May 29 18:46:58 2017 -0400

    scan for feedback emails requiring followup
---
 www/board/agenda/routes.rb | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/www/board/agenda/routes.rb b/www/board/agenda/routes.rb
index 8d5383b..003ce6c 100755
--- a/www/board/agenda/routes.rb
+++ b/www/board/agenda/routes.rb
@@ -53,6 +53,35 @@ get '/env' do
   JSON.pretty_generate(env: env, ENV: ENV.to_h, asset: asset)
 end
 
+# agenda followup
+get %r{/(\d\d\d\d-\d\d-\d\d)/followup\.json} do |date|
+  pass unless Dir.exist? '/srv/mail/board'
+
+  agenda = "board_agenda_#{date.gsub('-','_')}.txt"
+  pass unless Agenda.parse agenda, :quick
+  
+  # select agenda items that have comments
+  parsed = Agenda[agenda][:parsed]
+  followup = parsed.select {|item| not item['comments'].to_s.empty?}.
+    map {|item| [item['title'], {comments: item['comments'], 
+      shepherd: item['shepherd'], mail_list: item['mail_list'], count: 0}]}.
+    to_h
+  
+  # count number of feedback emails found in the board archive
+  start = Time.parse(date)
+  months = Dir['/srv/mail/board/*'].sort[-2..-1]
+  months = Dir['/srv/mail/board/*'].sort[-2..-1]
+  Dir[*months.map {|month| "#{month}/*"}].each do |file|
+    next unless File.mtime(file) > start
+    raw = File.read(file).force_encoding(Encoding::BINARY)
+    next unless raw =~ /Subject: .*Board feedback on 2017-05-17 (.*) report/
+    followup[$1][:count] += 1 if followup[$1]
+  end
+
+  # return results
+  _json followup
+end
+
 # all agenda pages
 get %r{/(\d\d\d\d-\d\d-\d\d)/(.*)} do |date, path|
   agenda = "board_agenda_#{date.gsub('-','_')}.txt"

-- 
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].

Reply via email to