Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions annotation/app/tasks/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -808,8 +808,10 @@ def finish_task(
db, x_current_tenant, task.job_id, task_id, task.file_id, task.pages
)
# accumulate info about pages, validated/annotated by him
validated, failed, annotated, not_processed, *_ = accumulate_pages_info(
task.pages, revisions, unique_status=True
validated, failed, annotated, not_processed, categories, _ = (
accumulate_pages_info(
task.pages, revisions, unique_status=True
)
)
# if same pages were annotated and marked as failed
# it means, that these pages are edited by validator
Expand All @@ -822,12 +824,13 @@ def finish_task(
annotated = annotated.difference(validated)

validate_user_actions(
task.is_validation,
failed,
annotated,
not_processed,
annotation_user,
validation_user,
is_validation=task.is_validation,
failed=failed,
annotated=annotated,
not_processed=not_processed,
categories=categories,
annotation_user=annotation_user,
validation_user=validation_user,
)
job = get_job(db, task.job_id, x_current_tenant)
if task.is_validation:
Expand Down
3 changes: 2 additions & 1 deletion annotation/app/tasks/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ def validate_user_actions(
failed: Set[int],
annotated: Set[int],
not_processed: Set[int],
categories: List[str],
annotation_user: bool,
validation_user: bool,
):
Expand All @@ -191,7 +192,7 @@ def validate_user_actions(
"should be null.",
)

if is_validation and not annotated and validation_user:
if is_validation and not (annotated or categories) and validation_user:
raise HTTPException(
status_code=400,
detail="Validator did not edit any pages, "
Expand Down