Move the vote counting out of larv-review's votes, so reading a votes file decides nothing

This commit is contained in:
2026-10-22 02:11:03 +02:00
parent 028d722b94
commit 8cdbff5fba
5 changed files with 29 additions and 14 deletions
+4 -2
View File
@@ -4,13 +4,13 @@ import time
from larv_review.agreement import agreement_report
from comprehension_history import appended, DIMENSIONS, FLOOR, heading, Heading, HISTORY, latest_places, recorded, ruling_entry, scoring_entry, ScoringRun, vote_text
from git_repo import commit_exists, top
from larv_review.ruling import counted, overall, ruling, split, votes
from larv_review.ruling import counted, overall, ruling, split, surplus, votes
from failure import Failure
from larv_review.scoring import means, under_floor
from larv_review.plan import plan_reasons
import rank_todo
from file_writes import replace_file
from larv_review.seats import scores, seats_file, SeatsFile
from larv_review.seats import FIRST_SEATS, scores, seats_file, SeatsFile
def record_ruling(votes_file: pathlib.Path) -> Failure | None:
@@ -24,6 +24,8 @@ def record_ruling(votes_file: pathlib.Path) -> Failure | None:
counts = counted(seats_read.seats, written)
tally = ", ".join(f"{seat.name} {vote_text(DIMENSIONS[-1], overall(written[seat.name]), overall(counts[seat.name]))}" for seat in seats_read.seats)
overall_votes = [overall(each) for each in counts.values()]
if surplus(overall_votes):
return Failure(f"{' and '.join(FIRST_SEATS)} both count as {overall_votes[0]} overall, which settles the ruling; drop the other seats' lines")
if split(overall_votes):
print(f"Split: {tally}. Launch the maintainability senior and Junior A together, add their lines to the votes file, and run this again.")
return None