Parse each comprehension history entry once into votes, scores and listings

This commit is contained in:
2026-11-08 19:28:39 +01:00
parent 134a200fba
commit ed72e284ca
4 changed files with 100 additions and 62 deletions
+3 -3
View File
@@ -1,6 +1,6 @@
import decimal
from comprehension_history import counted_vote, entries, Entry, overall_cells, scoring_runs
from comprehension_history import counted_vote, entries, Entry, last_cells, scoring_runs
from larv_review.seats import FIRST_SEATS
# Matches score-outcomes, which waits for 10 finished chunks before it shows a median.
@@ -10,7 +10,7 @@ MIN_PAIRS = 10
def ruling_agreement(found: list[Entry]) -> list[bool]:
"""For each paired ruling that holds both of the first seats' overall votes, whether they counted alike."""
first, second = FIRST_SEATS
cells = [overall_cells(entry) for entry in found if entry.paired]
cells = [last_cells(entry.votes) for entry in found if entry.paired]
return [counted_vote(each[first]) == counted_vote(each[second]) for each in cells if first in each and second in each]
@@ -19,7 +19,7 @@ def run_agreement(found: list[Entry]) -> list[bool]:
first, second = FIRST_SEATS
runs: dict[str, list[dict[str, decimal.Decimal]]] = {}
for entry in scoring_runs(found):
cells = overall_cells(entry)
cells = last_cells(entry.scores)
if first in cells and second in cells:
runs.setdefault(entry.commit, []).append({first: decimal.Decimal(cells[first]), second: decimal.Decimal(cells[second])})
pairs = [(each[0], each[1]) for each in runs.values() if len(each) >= 2]