You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by se...@apache.org on 2021/02/13 00:34:33 UTC
[whimsy] branch master updated: Use nominated-members.rb to parse
the file
This is an automated email from the ASF dual-hosted git repository.
sebb 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 d02a220 Use nominated-members.rb to parse the file
d02a220 is described below
commit d02a2205a1b9ceefc5ee969e84eb2e87cb298e3d
Author: Sebb <se...@apache.org>
AuthorDate: Sat Feb 13 00:34:06 2021 +0000
Use nominated-members.rb to parse the file
---
www/members/nominations.cgi | 19 +++++++------------
1 file changed, 7 insertions(+), 12 deletions(-)
diff --git a/www/members/nominations.cgi b/www/members/nominations.cgi
index e9c6e91..e5a31a4 100755
--- a/www/members/nominations.cgi
+++ b/www/members/nominations.cgi
@@ -6,6 +6,7 @@ require 'erb'
require 'mail'
require 'wunderbar/bootstrap'
require 'whimsy/asf'
+require 'whimsy/asf/nominated-members'
require_relative 'meeting-util'
# link to members private-arch
@@ -16,7 +17,7 @@ ROSTER = '/roster/committer'
MEETINGS = ASF::SVN['Meetings']
# Encapsulate gathering data to improve error processing
-def setup_data(cur_mtg_dir)
+def setup_data
# get a list of current year's members@ emails
year = Time.new.year.to_s
archive = Dir["/srv/mail/members/#{year}*/*"]
@@ -37,16 +38,8 @@ def setup_data(cur_mtg_dir)
end
# parse nominations for names and ids
- # TODO: share code with nominees.rb if possible
- nominations = IO.read(File.join(cur_mtg_dir, 'nominated-members.txt')).
- encode("utf-8", "utf-8", :invalid => :replace).
- scan(/^---+--\s+(?:[a-z_0-9-]+)\s+(.*?):?\n/).flatten
-
- nominations.shift if nominations.first == '<empty line>'
- nominations.pop if nominations.last.empty?
-
- nominations.map! do |line|
- {name: line.gsub(/<.*|\(\w+@.*/, '').strip, id: line[/([.\w]+)@/, 1]}
+ nominations = ASF::MemberFiles.member_nominees.map do |id, hash|
+ {id: id, name: hash['Public Name']}
end
# preload names
@@ -78,10 +71,12 @@ _html do
helpblock: -> {
_ 'This script checks new member nomination statements from members@ against the official meeting ballot files, and highlights differences. '
_ 'This probably only works in the period shortly before or after a Members meeting!'
+ _br
+ _ 'Entries are highlighted if they are not present in both lists.'
}
) do
cur_mtg_dir = MeetingUtil.get_latest(MEETINGS)
- nominations, people, emails = setup_data(cur_mtg_dir)
+ nominations, people, emails = setup_data
_div.flexbox do
_div.flexitem do
_h1_! do