Skip to content

Commit

Permalink
fix: query all pre annotations if sample name is specified
Browse files Browse the repository at this point in the history
  • Loading branch information
gary-Shen committed Jun 6, 2024
1 parent aa7c658 commit ce66599
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions labelu/internal/application/service/pre_annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,24 @@ async def list_by(
sorting: Optional[str],
current_user: User,
) -> Tuple[List[PreAnnotationResponse], int]:

pre_annotations = []

# 指定 sample_name 查询时,需要对所有的 pre_annotation 进行查询
if sample_name:
pre_annotations = db.query(TaskPreAnnotation).all()
else:
pre_annotations = crud_pre_annotation.list_by(
db=db,
task_id=task_id,
owner_id=current_user.id,
after=after,
before=before,
pageNo=pageNo,
pageSize=None if sample_name else pageSize,
sorting=sorting,
)

pre_annotations = crud_pre_annotation.list_by(
db=db,
task_id=task_id,
owner_id=current_user.id,
after=after,
before=before,
pageNo=pageNo,
pageSize=pageSize,
sorting=sorting,
)

total = crud_pre_annotation.count(db=db, task_id=task_id, owner_id=current_user.id)

Expand Down

0 comments on commit ce66599

Please sign in to comment.