Commit ef19c9f5 authored by Mustafa Gezen's avatar Mustafa Gezen 🏗
Browse files

Annotation problems may have been because of invalid schema. Retry

parent 98e6db78
......@@ -53,7 +53,8 @@ class NewBatchResponse(BaseModel):
@router.get("/imports/", response_model=Page[BatchImport_Pydantic], dependencies=[Depends(pagination_params)])
async def list_batch_imports():
return await paginate(
BatchImport.all().prefetch_related("imports", "imports__package", "imports__commits").order_by("-created_at"))
BatchImport.annotate(imports_count=Count('imports')).filter(imports_count__gte=2).all().prefetch_related(
"imports", "imports__package", "imports__commits").order_by("-created_at"))
@router.post("/imports/", response_model=NewBatchResponse)
......@@ -103,7 +104,9 @@ async def retry_failed_batch_imports(request: Request, batch_import_id: int):
@router.get("/builds/", response_model=Page[BatchBuild_Pydantic], dependencies=[Depends(pagination_params)])
async def list_batch_builds():
return await paginate(
BatchBuild.all().prefetch_related("builds", "builds__package", "builds__import_commit").order_by("-created_at"))
BatchBuild.annotate(builds_count=Count('builds')).filter(builds_count__gte=2).all().prefetch_related(
"builds", "builds__package", "builds__import_commit").order_by(
"-created_at"))
@router.post("/builds/", response_model=NewBatchResponse)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment