Append the reading-cost figure, refresh item 109, and read a todo.md from before C joined it

This commit is contained in:
2026-10-13 11:20:08 +02:00
parent 064bfe78f4
commit 228478061e
5 changed files with 36 additions and 9 deletions
+2 -2
View File
@@ -2,7 +2,7 @@ import pathlib
from failure import Failure
from larv_review.git import file_at, landed_since_release, top
from todo_table import Item, items, ITEMS_HEADER
from todo_table import Item, items, ITEMS_HEADER, LEGACY_HEADER
def scoring_run_due(before: list[Item], after: list[Item], ships: list[int], landed: bool) -> list[str] | Failure:
@@ -42,7 +42,7 @@ def plan_reasons(default: str, ids: list[int]) -> list[str] | Failure:
except (OSError, UnicodeDecodeError) as failure:
return Failure(f"could not read todo.md: {failure}")
# While a chunk reshapes todo.md into one table, the default branch's todo.md has no items table.
planned = items(before) if ITEMS_HEADER in before.splitlines() else []
planned = items(before) if {ITEMS_HEADER, LEGACY_HEADER} & set(before.splitlines()) else []
if isinstance(planned, Failure):
return Failure(f"{default}'s todo.md: {planned.reason}")
chunk = items(after)
+4
View File
@@ -192,6 +192,10 @@ class ScoringRunDue(unittest.TestCase):
self.assertIsInstance(items("# todo\n"), Failure)
self.assertIsInstance(items(todo("| 0 | 0.1.0 | | **Do it.** | 1 | 1 | 3 | 1 | 1 | 1 | 9.0 |")), Failure)
def test_reads_a_table_from_before_c_joined_it(self):
legacy = "## Items\n\n| ID | Release | Exempt | Item | R | S | A | G | Goals | Score |\n|---|---|---|---|---|---|---|---|---|---|\n| 3 | 0.1.0 | | **Do it.** | 1 | 1 | 1 | 1 | 1 | 9.0 |\n"
self.assertEqual(items(legacy), [Item(3, (0, 1, 0), "", "**Do it.**", {"R": 1, "S": 1, "A": 1, "G": 1}, ("1",))])
def test_is_due_for_an_item_naming_the_floor(self):
plan = [item(1, (0, 1, 0), "**Lift the project to the Comprehension floor.**"), item(2, (0, 1, 0))]
self.assertEqual(scoring_run_due(plan, plan, [1], True), ["ships item 1, which names the comprehension floor"])