start to decouple from 2015

Project: https://git-dual.apache.org/repos/asf/whimsy/repo
Commit: https://git-dual.apache.org/repos/asf/whimsy/commit/5c728a62
Tree: https://git-dual.apache.org/repos/asf/whimsy/tree/5c728a62
Diff: https://git-dual.apache.org/repos/asf/whimsy/diff/5c728a62

Branch: refs/heads/master
Commit: 5c728a62986f78577cfaec8111d6beac1210d033
Parents: c283f67
Author: Sam Ruby <[email protected]>
Authored: Mon Feb 22 10:11:27 2016 -0500
Committer: Sam Ruby <[email protected]>
Committed: Mon Feb 22 12:03:36 2016 -0500

----------------------------------------------------------------------
 www/members/nominations.cgi | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


https://git-dual.apache.org/repos/asf/whimsy/blob/5c728a62/www/members/nominations.cgi
----------------------------------------------------------------------
diff --git a/www/members/nominations.cgi b/www/members/nominations.cgi
index 8c6d738..67c8413 100755
--- a/www/members/nominations.cgi
+++ b/www/members/nominations.cgi
@@ -6,16 +6,19 @@ require 'wunderbar'
 require 'whimsy/asf'
 
 # link to members private-arch
-MBOX = 
"https://mail-search.apache.org/members/private-arch/members/201503.mbox/";
+MBOX = 'https://mail-search.apache.org/members/private-arch/members/'
 
 # get a list of current members messages
 archive = Dir['/home/apmail/members/archive/*/*']
 
 # select messages that have a subject line starting with [MEMBER NOMINATION]
 emails = []
+year = Time.new.year.to_s
 archive.each do |email|
   next if email.end_with? '/index'
   message = IO.read(email, mode: 'rb')
+  puts message[/^Date: .*/]
+  next unless message[/^Date: .*/].to_s.include? year
   subject = message[/^Subject: .*/]
   next unless subject.include? "[MEMBER NOMINATION]"
   mail = Mail.new(message)
@@ -28,7 +31,8 @@ meeting = Dir["#{MEETINGS}/2*"].sort.last
 nominations = IO.read("#{meeting}/nominated-members.txt").
   scan(/^-+--\s+(.*?)\n/).flatten.
   map {|name| name.gsub(/<.*|\(\w+@.*/, '').strip}
-nominations.shift
+nominations.shift if nominations.first.empty?
+nominations.pop if nominations.last.empty?
 
 
 url = `cd #{meeting}; svn info`[/URL: (.*)/, 1]
@@ -58,7 +62,8 @@ _html do
   # output an unordered list of subjects linked to the message archive
   _ul emails do |mail|
     _li do
-      href = MBOX + URI.escape('<' + mail.message_id + '>')
+      href = MBOX + mail.date.strftime('%Y%m') + '.mbox/' + 
+        URI.escape('<' + mail.message_id + '>')
 
       if nominations.any? {|name| mail.subject.downcase =~ /\b#{name}\b/}
         _a.present mail.subject, href: href

Reply via email to