Answer principles round 1: 0 🔴, 4 🟡 (0 misread); stage types for the cut and shipped chunks, one text_at, the path rule in the core, a parse that fails as a value
This commit is contained in:
@@ -86,24 +86,26 @@ def report(results: list[Result]) -> list[str]:
|
||||
|
||||
def misreads(results: list[Result]) -> list[str]:
|
||||
"""Newest first, each chunk's 🔴 and 🟡 findings with how many of them a reviewer marked `[misread]`, for each chunk whose round titles count those."""
|
||||
# A chunk that shipped several items has a Result for each, so one line per chunk.
|
||||
chunks = {result.merge: result for result in results}
|
||||
newest_first = sorted(chunks.values(), key=lambda result: result.merged, reverse=True)
|
||||
lines = [f"- {result.merged} in {result.merge}: {counted(result)}" for result in newest_first if result.findings is not None and result.findings.misread is not None]
|
||||
lines = [f"- {result.merged} in {result.merge}: {counted(result)}" for result in one_per_chunk(results) if result.findings is not None and result.findings.misread is not None]
|
||||
return lines or ["- None: no chunk's round titles count them."]
|
||||
|
||||
|
||||
def fixed_later(results: list[Result]) -> list[str]:
|
||||
"""Newest first, each finished chunk that later chunks fixed code of, naming them, then how many finished chunks none fixed."""
|
||||
chunks = {result.merge: result for result in results}
|
||||
newest_first = sorted(chunks.values(), key=lambda result: result.merged, reverse=True)
|
||||
lines = [f"- {result.merged} in {result.merge}: {later(result)}, by {listed(result.fixed_by, 'and')}" for result in newest_first if result.fixed_by]
|
||||
chunks = one_per_chunk(results)
|
||||
lines = [f"- {result.merged} in {result.merge}: {later(result)}, by {listed(result.fixed_by, 'and')}" for result in chunks if result.fixed_by]
|
||||
if not lines:
|
||||
return ["- None: no later chunk fixed code a finished chunk shipped."]
|
||||
others = len(chunks) - len(lines)
|
||||
return lines + ([f"- The other {plural(others, 'finished chunk')}: none."] if others else [])
|
||||
|
||||
|
||||
def one_per_chunk(results: list[Result]) -> list[Result]:
|
||||
"""One result for each chunk, newest first: a chunk that shipped several items has a Result for each, and the report gives each chunk one line."""
|
||||
chunks = {result.merge: result for result in results}
|
||||
return sorted(chunks.values(), key=lambda result: result.merged, reverse=True)
|
||||
|
||||
|
||||
def too_few(held: int, name: str, what: str) -> str:
|
||||
chunks = "such chunk records" if held == 1 else "such chunks record"
|
||||
return f"{held} {chunks} {name} and {what}; the report needs {ENOUGH}."
|
||||
|
||||
Reference in New Issue
Block a user