Skip to content

Commit

Permalink
Add PROJECT_COMPLETED_STATUSES to account for deleted status (#2639)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bobronium authored Oct 16, 2024
1 parent 259115d commit 809c28d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from src.endpoints.serializers import (
ASSIGNMENT_PROJECT_VALIDATION_STATUSES,
PROJECT_ACTIVE_STATUSES,
PROJECT_COMPLETED_STATUSES,
serialize_assignment,
serialize_job,
)
Expand Down Expand Up @@ -146,9 +147,7 @@ async def list_jobs(
cvat_service.Project.status == cvat_service.ProjectStatuses.canceled
)
case JobStatuses.completed:
query = query.filter(
cvat_service.Project.status == cvat_service.ProjectStatuses.recorded
)
query = query.filter(cvat_service.Project.status.in_(PROJECT_COMPLETED_STATUSES))
case _:
raise NotImplementedError(f"Unsupported status {status}")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,15 @@
from src.schemas import exchange as service_api
from src.utils.assignments import compose_assignment_url, parse_manifest

PROJECT_ACTIVE_STATUSES = [
PROJECT_ACTIVE_STATUSES = {
ProjectStatuses.annotation,
ProjectStatuses.completed,
ProjectStatuses.validation,
]
}
PROJECT_COMPLETED_STATUSES = {
ProjectStatuses.recorded,
ProjectStatuses.deleted,
}


def serialize_job(
Expand Down Expand Up @@ -48,7 +52,7 @@ def serialize_job(
api_status = service_api.JobStatuses.canceled
elif project.status in PROJECT_ACTIVE_STATUSES:
api_status = service_api.JobStatuses.active
elif project.status == ProjectStatuses.recorded:
elif project.status in PROJECT_COMPLETED_STATUSES:
api_status = service_api.JobStatuses.completed
else:
raise NotImplementedError(f"Unknown status {project.status}")
Expand Down

0 comments on commit 809c28d

Please sign in to comment.