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 e81e78f  final tweak for new vote-results.json format
e81e78f is described below

commit e81e78f99fc2f48aeb2e802b4fac172f21c623f1
Author: Greg Stein <[email protected]>
AuthorDate: Thu Mar 5 17:07:25 2026 -0600

    final tweak for new vote-results.json format
---
 monitoring/stv_tool.py | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/monitoring/stv_tool.py b/monitoring/stv_tool.py
index 5340cf9..4ef11ce 100755
--- a/monitoring/stv_tool.py
+++ b/monitoring/stv_tool.py
@@ -491,12 +491,22 @@ def main(argv):
   else:
     jvalue = None
 
-  if jvalue and 'candidates' in jvalue:
+  if jvalue and 'results' in jvalue:
     # This is a modern (v3 starting in 2026) vote-results.json file.
     # It contains everything we need.
-    labelmap = jvalue['labelmap']
 
-    votes_by_label = jvalue['votestrings']
+    # Find the single/first STV issue in the results.
+    for issue in jvalue['results'].values():
+      if issue['vtype'] == 'stv':
+        break
+    else:
+      print('No STV issue found.')
+      sys.exit(1)
+
+    data = issue['supporting_data']
+    labelmap = data['labelmap']
+
+    votes_by_label = data['votestrings']
     votes = [[labelmap[l] for l in vote.split(',')] for vote in votes_by_label]
 
   else:

Reply via email to