Keep footer rows in table, mark with is_footer + col_type=footer

Footer rows like "two hundred and twelve" are no longer removed from
the grid. Instead they stay in cells/rows and get tagged so the
frontend can render them differently.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Benjamin Admin
2026-03-20 09:08:25 +01:00
parent 278067fe20
commit 0f9c0d2ad0

View File

@@ -1938,13 +1938,15 @@ async def _build_grid_core(session_id: str, session: dict) -> dict:
"bbox_pct": last_cells[0].get("bbox_pct", {}), "bbox_pct": last_cells[0].get("bbox_pct", {}),
}) })
# Remove footer rows from the table # Mark footer rows (keep in table, just tag for frontend)
if footer_rows: if footer_rows:
remove_ris = {fr["row_index"] for fr in footer_rows} footer_ris = {fr["row_index"] for fr in footer_rows}
z["cells"] = [c for c in z["cells"] for r in z["rows"]:
if c.get("row_index") not in remove_ris] if r["index"] in footer_ris:
z["rows"] = [r for r in z["rows"] r["is_footer"] = True
if r["index"] not in remove_ris] for c in z["cells"]:
if c.get("row_index") in footer_ris:
c["col_type"] = "footer"
if page_refs or footer_rows: if page_refs or footer_rows:
logger.info( logger.info(