Skip to content

Commit

Permalink
Also add a board_ballot/availid.txt file on new director noms
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaneCurcuru committed Jan 31, 2025
1 parent f9df633 commit e42bd46
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
13 changes: 13 additions & 0 deletions lib/whimsy/asf/member-files.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 3 additions & 1 deletion www/members/nominate_board.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand All @@ -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
Expand Down

0 comments on commit e42bd46

Please sign in to comment.