Drop the comprehension panel as a merge gate, and feed the places its seats found hard to the architect, the stability reviewer and item filing
This commit is contained in:
@@ -102,6 +102,17 @@ def entries(history: str) -> list[Entry]:
|
||||
return found
|
||||
|
||||
|
||||
def latest_places(history: str) -> str | None:
|
||||
"""The heading and the seats' places of the newest entry, by its time, whose seats scored the project: a scoring run, or a ruling whose fall called the scoring seats. None when no entry did."""
|
||||
scored = [(named.group(1), heading, "\n".join(bodies)) for heading, bodies in sections(history).items() if (named := HEADING.match(heading)) and seat_places("\n".join(bodies), SCORED_PLACES)]
|
||||
if not scored:
|
||||
return None
|
||||
_, heading, body = max(scored)
|
||||
lines = body.splitlines()
|
||||
start = next(index for index, line in enumerate(lines) if SCORED_PLACES.match(line))
|
||||
return f"## {heading}\n" + "".join(f"\n{line}\n\n" if SCORED_PLACES.match(line) else f"{line}\n" for line in lines[start:])
|
||||
|
||||
|
||||
def recorded(history: str, read: str) -> bool:
|
||||
"""Whether the history holds an entry on what a seats file's first line says the seats read."""
|
||||
return any(entry.heading.partition(", ")[2] == read for entry in entries(history))
|
||||
@@ -146,12 +157,10 @@ def appended(history: str, entry: str) -> str:
|
||||
return f"{text}\n{entry}"
|
||||
|
||||
|
||||
def ruling_entry(title: str, seats: list[Seat], said: dict[str, list[str]], counted: dict[str, list[str]], ruled: str, notes: list[str], scoring: ScoringRun | None) -> str:
|
||||
"""A paired ruling's entry, with any notes, such as why a fall decided it, and the scores that decided a fall; a seat's vote that counted as same for want of a place says so."""
|
||||
def ruling_entry(title: str, seats: list[Seat], said: dict[str, list[str]], counted: dict[str, list[str]], ruled: str) -> str:
|
||||
"""A paired ruling's entry; a seat's vote that counted as same for want of a place says so."""
|
||||
votes = [[seat.name, *map(vote_text, DIMENSIONS, said[seat.name], counted[seat.name])] for seat in seats]
|
||||
tables = [[["Seat", *DIMENSIONS], *votes]] + ([scores_table(scoring)] if scoring else [])
|
||||
labels = [(f"{seat.name}, {DECIDED_BY}:", seat.places) for seat in seats] + (scoring_labels(scoring.seats) if scoring else [])
|
||||
return entry_text(title, [f"Ruling: {ruled}", *notes], tables, labels)
|
||||
return entry_text(title, [f"Ruling: {ruled}"], [[["Seat", *DIMENSIONS], *votes]], [(f"{seat.name}, {DECIDED_BY}:", seat.places) for seat in seats])
|
||||
|
||||
|
||||
def vote_text(dimension: str, said: str, counted: str) -> str:
|
||||
|
||||
Reference in New Issue
Block a user