[verified] fix exam auto-map duplicate continued parts
api-ci-deploy / test-build-deploy (push) Has been cancelled

(cherry picked from commit 31c51cb7aa)
This commit is contained in:
2026-06-08 17:47:56 +00:00
committed by CC Worker
parent 76e11b0b06
commit 150b915282
2 changed files with 27 additions and 0 deletions
+6
View File
@@ -507,6 +507,12 @@ def _map_first_pass_to_rows(template_id: str, first_pass: Dict[str, Any], pdf_by
questions.append({"id": parent_id, "template_id": template_id, "label": parent_label, "order": len(q_ids) - 1, "max_marks": 0, "is_container": True, "source": "ai", "confirmed": False, "confidence": 0.7, "derivation": "docling-inferred-main-question"})
pid = _ai_id(template_id, "part", label)
first_part_by_page.setdefault(page_index, pid)
# B1 live-route papers can carry continuation bands for the same part label
# on later pages. The UUID is intentionally stable per template+part label,
# so only insert the first question row; later continuations still map
# response/context regions through first_part_by_page.
if any(q["id"] == pid for q in questions):
continue
bounds = None
y1, y2 = band.get("y_start"), band.get("y_end")
if margins["left"] is not None and margins["right"] is not None and y1 is not None and y2 is not None: