Add per label remark, post correction
This commit is contained in:
1 parent
3abd7873e6
commit
8918d64452
13 files changed
+343
-23
No files matched your search
@@ -79,8 +79,9 @@ def update_named_return_answers(
|
||||
annotation_dir_name: str,
|
||||
*,
|
||||
copy_ids: Collection[str] | None = None,
|
||||
refresh_named: bool = False,
|
||||
) -> ExitCode:
|
||||
"""Refresh answers/ in existing returns, optionally only successful rereads."""
|
||||
"""Refresh answers/; readers also refresh named outputs after successful rereads."""
|
||||
if copy_ids is not None and (not copy_ids or not workspace.return_dir.is_dir()):
|
||||
return ExitCode.SUCCESS
|
||||
workspace.require_directories(annotation_dir_name, "A Rendre")
|
||||
@@ -118,6 +119,18 @@ def update_named_return_answers(
|
||||
destination,
|
||||
answers_only=True,
|
||||
)
|
||||
if refresh_named:
|
||||
stem = destination.name[:match.start()].rstrip()
|
||||
for source_name, suffix, enabled in (
|
||||
("Concat.jpg", ".jpg", configuration.RETURN_JPEG_ENABLED),
|
||||
("Concat_F.pdf", ".pdf", configuration.RETURN_PDF_ENABLED),
|
||||
):
|
||||
source = source_folder / source_name
|
||||
target = destination / (stem + suffix)
|
||||
if enabled and source.is_file():
|
||||
replace_with_link_or_copy(source, target, prefer="symlink")
|
||||
else:
|
||||
target.unlink(missing_ok=True)
|
||||
print(f"Updated answers for {destination.name} from Copie{copy_id}")
|
||||
except (OSError, TypeError, ValueError) as exc:
|
||||
print(f"Error updating answers for {destination.name}: {exc}", file=sys.stderr)
|
||||
|
||||
@@ -25,6 +25,7 @@ from copienator.annotation_data import AnnotationData, load_annotation_data
|
||||
from copienator.annotation_documents import copy_documents
|
||||
from copienator.annotation_layout import legacy_layout
|
||||
from copienator.annotation_read_cache import AnnotationReadCache
|
||||
from copienator.custom_remarks import apply_custom_remarks
|
||||
from copienator.annotation_modifications import (
|
||||
BASELINE,
|
||||
output_removals,
|
||||
@@ -175,6 +176,7 @@ def apply_actions_and_regenerate(
|
||||
|
||||
labels_data = data[student_id]
|
||||
apply_checkbox_actions(labels_data, actions, print)
|
||||
apply_custom_remarks(workspace.root, student_id, labels_data)
|
||||
score_path = output_dir / "score.json"
|
||||
preserve_score_file = update_score and score_path.is_file()
|
||||
if update_score:
|
||||
@@ -381,7 +383,7 @@ def run(
|
||||
status = ExitCode.PARTIAL
|
||||
else:
|
||||
regenerated.add(student_id)
|
||||
if update_named_return_answers(workspace, "Bnot", copy_ids=regenerated) != ExitCode.SUCCESS:
|
||||
if update_named_return_answers(workspace, "Bnot", copy_ids=regenerated, refresh_named=True) != ExitCode.SUCCESS:
|
||||
status = ExitCode.PARTIAL
|
||||
elif cache is not None:
|
||||
cache.remember(regenerated)
|
||||
|
||||
@@ -28,6 +28,7 @@ from copienator.annotation_data import AnnotationData, RefaireList, load_annotat
|
||||
from copienator.annotation_documents import copy_documents, tablet_documents
|
||||
from copienator.annotation_layout import legacy_layout
|
||||
from copienator.annotation_read_cache import AnnotationReadCache
|
||||
from copienator.custom_remarks import apply_custom_remarks
|
||||
from copienator.annotation_modifications import (
|
||||
BASELINE,
|
||||
baseline,
|
||||
@@ -235,6 +236,7 @@ def apply_actions_and_regenerate_grouped(
|
||||
output_dir = workspace.root / annotation_dir / f"Copie{student_id}"
|
||||
labels_data = data.get(student_id, {})
|
||||
apply_checkbox_actions(labels_data, actions, logs.append)
|
||||
apply_custom_remarks(workspace.root, student_id, labels_data)
|
||||
score_path = output_dir / "score.json"
|
||||
preserve_score_file = update_score and score_path.is_file()
|
||||
if update_score:
|
||||
@@ -700,7 +702,7 @@ def run(
|
||||
status = ExitCode.PARTIAL
|
||||
else:
|
||||
regenerated.add(futures[future])
|
||||
if update_named_return_answers(workspace, annotation_dir, copy_ids=regenerated) != ExitCode.SUCCESS:
|
||||
if update_named_return_answers(workspace, annotation_dir, copy_ids=regenerated, refresh_named=True) != ExitCode.SUCCESS:
|
||||
status = ExitCode.PARTIAL
|
||||
elif cache is not None:
|
||||
cache.remember(regenerated)
|
||||
|
||||
Reference in new issue
Block a user