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

gstein pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/steve.git

commit b3b67847dec5e291c5cada846f1905a38c9135dd
Author: Greg Stein <[email protected]>
AuthorDate: Fri Feb 20 10:05:58 2026 -0600

    feat: replace eligible_voters with record-based voter list from YAML
    
    Co-authored-by: aider (openrouter/x-ai/grok-code-fast-1) <[email protected]>
---
 v3/server/bin/create-election.py | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/v3/server/bin/create-election.py b/v3/server/bin/create-election.py
index 9b44718..d1ac618 100755
--- a/v3/server/bin/create-election.py
+++ b/v3/server/bin/create-election.py
@@ -78,10 +78,10 @@ def main(yaml_file):
     for issue in issues:
         validate_issue(issue)
 
-    # Extract voters tag (placeholder: assume "members" means all persons)
-    eligible_voters = data.get('eligible_voters')
-    if eligible_voters != 'members':
-        raise ValueError("Only 'members' is supported for eligible_voters")
+    # Extract record: list of pid values for eligible voters
+    record = data.get('record', [])
+    if not isinstance(record, list):
+        raise ValueError('record must be a list of pid values')
 
     ### revising how we manage the two database instances and their
     ### connections. no transactions for now. partial Elections, and
@@ -118,11 +118,16 @@ def main(yaml_file):
         ### q_person: SELECT * FROM person ORDER BY pid
         pdb.q_person = pdb.db.cursor_for('SELECT * FROM person ORDER BY pid')
 
-        # Add voters: All persons in persondb to all issues
+        # Get all persons
         all_persons = pdb.list_persons()
-        for person in all_persons:
-            election.add_voter(person.pid)
-        _LOGGER.info(f'Added {len(all_persons)} voters to 
election[E:{election.eid}]')
+        all_pids = {person.pid for person in all_persons}
+
+        # Validate and add voters from record
+        for pid in record:
+            if pid not in all_pids:
+                raise ValueError(f'PID {pid} from record not found in person 
database')
+            election.add_voter(pid)
+        _LOGGER.info(f'Added {len(record)} voters to 
election[E:{election.eid}]')
 
         ### we aren't doing transactions right now. omit this.
         # pdb.db.conn.execute('COMMIT')

Reply via email to