From e42bd469e3fb4e7dfd7a971a42ec463d7f470b32 Mon Sep 17 00:00:00 2001 From: Shane Curcuru Date: Fri, 31 Jan 2025 13:24:44 -0500 Subject: [PATCH] Also add a board_ballot/availid.txt file on new director noms --- lib/whimsy/asf/member-files.rb | 13 +++++++++++++ www/members/nominate_board.cgi | 4 +++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/whimsy/asf/member-files.rb b/lib/whimsy/asf/member-files.rb index 8f99a1f6a0..cc3c83a4a0 100644 --- a/lib/whimsy/asf/member-files.rb +++ b/lib/whimsy/asf/member-files.rb @@ -12,6 +12,8 @@ class MemberFiles NOMINATED_MEMBERS = 'nominated-members.txt' NOMINATED_BOARD = 'board_nominations.txt' + BOARD_BALLOT = 'board_ballot' + BOARD_BALLOT_EXT = '.txt' NAME2OUTPUTKEY = { # names (from Regex) and corresponding output keys 'email' => 'Nominee email', 'nomby' => 'Nominated by', @@ -215,6 +217,17 @@ def self.update_member_nominees(env, wunderbar, entries=nil, msg=nil, opt={}) end end + # create a single director ballot statement (if not present) + # @param availid of director nominee + def self.add_board_ballot(env, wunderbar, availid, msg=nil, opt={}) + bfile = File.join(latest_meeting(), BOARD_BALLOT, "#{availid}#{BOARD_BALLOT_EXT}") + opt[:diff] = true unless opt.include? :diff # default to true + ASF::SVN.update(bfile, msg || 'Adding board_ballot template', env, wunderbar, opt) do |_tmpdir, contents| + # We merely create this file if not already present; don't change existing contents + contents + end + end + # update the board nominees def self.update_board_nominees(env, wunderbar, entries=nil, msg=nil, opt={}) nomfile = latest_meeting(NOMINATED_BOARD) diff --git a/www/members/nominate_board.cgi b/www/members/nominate_board.cgi index bd69352f8c..75198c9394 100755 --- a/www/members/nominate_board.cgi +++ b/www/members/nominate_board.cgi @@ -69,9 +69,10 @@ def validate_form(formdata: {}) end # Handle submission (checkout board_nominations.txt, write form data, checkin file) +# Also creates a board_ballot/availid.txt file for director statements # @return true if we think it succeeded; false in all other cases def process_form(formdata: {}, wunderbar: {}) - _h3 "Transcript of update to nomination file #{ASF::MemberFiles::NOMINATED_BOARD}" + _h3 "Transcript of updates to nomination files #{ASF::MemberFiles::NOMINATED_BOARD} for candidate #{formdata['availid']}" entry = ASF::MemberFiles.make_board_nomination({ availid: formdata['availid'], nomby: formdata['nomby'], @@ -80,6 +81,7 @@ def process_form(formdata: {}, wunderbar: {}) }) environ = Struct.new(:user, :password).new($USER, $PASSWORD) + ASF::MemberFiles.add_board_ballot(environ, wunderbar, "#{formdata['availid']}", "nominee statements += #{formdata['availid']}") ASF::MemberFiles.update_board_nominees(environ, wunderbar, [entry], "+= #{formdata['availid']}") return true end