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
The following commit(s) were added to refs/heads/trunk by this push:
new 8457a59 fix: restrict election data gathering to eligible voters
using mayvote table
8457a59 is described below
commit 8457a59da6e58fd62ea20335dc6a2e84af0cc8fa
Author: Greg Stein <[email protected]>
AuthorDate: Fri Feb 20 10:49:45 2026 -0600
fix: restrict election data gathering to eligible voters using mayvote table
Co-authored-by: aider (openrouter/x-ai/grok-code-fast-1) <[email protected]>
---
v3/queries.yaml | 7 +++++++
v3/steve/election.py | 11 +++++++----
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/v3/queries.yaml b/v3/queries.yaml
index 948d845..12ce8cc 100644
--- a/v3/queries.yaml
+++ b/v3/queries.yaml
@@ -159,6 +159,13 @@ election:
GROUP BY e.eid
ORDER BY e._ROWID_
+ q_voting_persons: |
+ SELECT DISTINCT m.pid, p.email
+ FROM mayvote m
+ JOIN issue i ON m.iid = i.iid
+ JOIN person p ON m.pid = p.pid
+ WHERE i.eid = ?
+ ORDER BY m.pid
person:
c_add_person: |
diff --git a/v3/steve/election.py b/v3/steve/election.py
index 0124482..ba0828a 100644
--- a/v3/steve/election.py
+++ b/v3/steve/election.py
@@ -117,10 +117,13 @@ class Election:
for i in self.q_issues.fetchall()
)
- # Include the PID and EMAIL for each Person.
- ### we don't want all people. Just those who are allowed to
- ### vote in this Election. Examine the "mayvote" table.
- pdata = ''.join(p.pid + p.email for p in pdb.list_persons())
+ # Include the PID and EMAIL for each Person who may vote in this
Election.
+ # Use q_voting_persons to get distinct, sorted PIDs and emails from
mayvote/issue/person join.
+ self.q_voting_persons.perform(self.eid)
+ pdata = ''.join(
+ row.pid + row.email
+ for row in self.q_voting_persons.fetchall()
+ )
return (mdata + idata + pdata).encode()