This is an automated email from the ASF dual-hosted git repository.

curcuru 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 e42bd469 Also add a board_ballot/availid.txt file on new director noms
e42bd469 is described below

commit e42bd469e3fb4e7dfd7a971a42ec463d7f470b32
Author: Shane Curcuru <[email protected]>
AuthorDate: Fri Jan 31 13:24:44 2025 -0500

    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 8f99a1f6..cc3c83a4 100644
--- a/lib/whimsy/asf/member-files.rb
+++ b/lib/whimsy/asf/member-files.rb
@@ -12,6 +12,8 @@ module ASF
 
     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 @@ module ASF
       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 bd69352f..75198c93 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

Reply via email to