diff --git a/annotation/app/tasks/resources.py b/annotation/app/tasks/resources.py index 686d7c87b..80d62d128 100644 --- a/annotation/app/tasks/resources.py +++ b/annotation/app/tasks/resources.py @@ -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 @@ -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: diff --git a/annotation/app/tasks/services.py b/annotation/app/tasks/services.py index 65976e12c..70ede8ac5 100644 --- a/annotation/app/tasks/services.py +++ b/annotation/app/tasks/services.py @@ -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, ): @@ -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, "