Improve web finalisation navigation, caching and Anot support

This commit is contained in:
sebastien committed 2026-11-03 11:38:39 +01:00
1 parent 5de70dbc0d
commit b069805988
21 files changed
+339 -58

No files matched your search

+10 -1
View File
@@ -516,6 +516,7 @@ def process_student(student_id, labels_data, root_dir, all_labels, overwrite):
d_notes = dict.fromkeys(all_labels, "")
label_images = []
answer_labels = []
reviewed_layouts = {}
sorted_labels = sorted(labels_data.items(), key=lambda item: natural_key(item[0]))
for label, content in sorted_labels:
@@ -534,7 +535,7 @@ def process_student(student_id, labels_data, root_dir, all_labels, overwrite):
result = content.get('result', {})
coordinates = content.get('coordinates', (0, 0))
d_notes[label] = str(result.get('score', 0))
final_img, _ = compose_label_image(
final_img, header_height = compose_label_image(
base_img,
label,
result,
@@ -543,6 +544,8 @@ def process_student(student_id, labels_data, root_dir, all_labels, overwrite):
render_fn=render_real_latex_text,
source_pdf=pdf_full_path,
)
reviewed_layouts[label] = {'img': None, 'old_header_h': header_height,
'layout': final_img.info.get('annotation_layout', layout_for(pdf_full_path))}
final_img.save(staging / f"{label}.jpg")
if result.get('error', "") != "empty-answer":
label_images.append(final_img)
@@ -561,7 +564,13 @@ def process_student(student_id, labels_data, root_dir, all_labels, overwrite):
canvas.paste(image, (0, current_y))
current_y += image.height
canvas.save(staging / "Concat.jpg")
if not problems:
from copienator.review_snapshot import stage
stage(output_dir, staging, labels_data, reviewed_layouts, engine='grouped')
# An all-empty copy still has valid individual return images.
if not problems:
from copienator.reviewed_cache import ReviewedReadCache
ReviewedReadCache(EvaluationWorkspace(Path(root_dir)), "Anot", [output_dir]).remember([student_id])
return "partial" if problems else "success"