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 2025/03/08 01:52:06 UTC

(whimsy) branch master updated: Beware auto-vivification: na_emails[id] was creating empty array

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 ba5a5290 Beware auto-vivification: na_emails[id] was creating empty array
ba5a5290 is described below

commit ba5a529011674f48ed007c3ee5e1299fed288e95
Author: Sebb <se...@apache.org>
AuthorDate: Sat Mar 8 01:52:01 2025 +0000

    Beware auto-vivification: na_emails[id] was creating empty array
---
 www/members/check_invitations.cgi | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/www/members/check_invitations.cgi b/www/members/check_invitations.cgi
index fb413a6d..1ec8c67c 100755
--- a/www/members/check_invitations.cgi
+++ b/www/members/check_invitations.cgi
@@ -86,12 +86,12 @@ def setup_data
   end
 
   nominated_by = {}
-  na_emails = Hash.new {|h,k| h[k] = Array.new} # emails for n/a ids from member-nominations
+  na_emails = {} # emails for n/a ids from member-nominations
   # n/a entries are not necessarily in the same order as in member-apps
   ASF::MemberFiles.member_nominees.each do |k, v|
     if k.start_with? 'n/a_'
       k = 'n/a_' + v['Public Name']
-      na_emails[k] << v['Nominee email']
+      na_emails[k] = [v['Nominee email']]
     end
     nominated_by[k] = v['Nominated by']
   end
@@ -100,7 +100,9 @@ def setup_data
   begin
     extras = YAML.load_file(File.join(File.dirname(memappfile),'notinavail.yml'))
     extras[:emails].each do |name, email|
-      na_emails['n/a_' + name] += email
+      k = 'n/a_' + name
+      na_emails[k] ||= []
+      na_emails[k] += email
     end
   rescue StandardError
     # ignored