Answer architecture round 1: 4 🔴, 5 🟡 (0 misread); one-way plan packages with a plan core and an Atlassian client, one parse and print of an item's cells, a pure chunk-start decision, a settings table, one plan read and one standing per pick, one config load in chunk-pr, notifier backends in notifier, and the bin regroup filed as item 392
This commit is contained in:
+5
-16
@@ -1,28 +1,17 @@
|
||||
"""How todo-item prints items: as rows of the table `rank_todo.py --help` shows, whatever backend holds the plan, without the Score a markdown plan alone has."""
|
||||
from release_plan.todo_table import BLOCKED_BY, Item, OLD_SHAPE, SHAPE, Shape
|
||||
from release_plan.release import version
|
||||
from plan.todo_table import detail_heading, Item, items_shape, row_cells, tagline_text
|
||||
|
||||
|
||||
def table(items: list[Item]) -> str:
|
||||
"""A markdown table of items, in their order."""
|
||||
shape = shape_of(items)
|
||||
shape = items_shape(items)
|
||||
columns = [column for column in shape.columns if column != "Score"]
|
||||
return "\n".join(["| " + " | ".join(columns) + " |", "|" + "---|" * len(columns), *(row(item, shape) for item in items)])
|
||||
|
||||
|
||||
def shape_of(items: list[Item]) -> Shape:
|
||||
"""OLD_SHAPE where an item holds a score only that shape has, as a plan not yet reshaped does."""
|
||||
return OLD_SHAPE if any(set(item.scores) - set(SHAPE.score_columns) for item in items) else SHAPE
|
||||
|
||||
|
||||
def row(item: Item, shape: Shape) -> str:
|
||||
named = {"ID": item.id, "Release": version(item.release), BLOCKED_BY: ", ".join(str(id_) for id_ in item.blocked_by), "Exempt": item.exempt, "Item": item.tagline, shape.goals_column: shape.write_goals(item.moves), **item.scores}
|
||||
return "| " + " | ".join(str(named.get(column, "")) for column in shape.columns if column != "Score") + " |"
|
||||
rows = [row_cells(item, shape) for item in items]
|
||||
return "\n".join(["| " + " | ".join(columns) + " |", "|" + "---|" * len(columns), *("| " + " | ".join(row.get(column, "") for column in columns) + " |" for row in rows)])
|
||||
|
||||
|
||||
def shown(item: Item) -> str:
|
||||
"""item's row under the table's header, then its detail under the heading a markdown plan gives it; the row alone where it has no detail."""
|
||||
if not item.detail:
|
||||
return table([item])
|
||||
tagline = item.tagline.removeprefix("**").removesuffix("**").replace("\\|", "|")
|
||||
return f"{table([item])}\n\n### {item.id}. {tagline}\n\n{item.detail}"
|
||||
return f"{table([item])}\n\n{detail_heading(item.id, tagline_text(item.tagline))}\n\n{item.detail}"
|
||||
|
||||
Reference in New Issue
Block a user