Skip to content

Commit

Permalink
fix: remove owner_id param in list pre_annotations (#192)
Browse files Browse the repository at this point in the history
  • Loading branch information
gary-Shen authored Feb 21, 2025
1 parent 3591bcf commit f917091
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ def upgrade() -> None:
)

# Performances index
is_index_2_exist = op.execute(
"SHOW INDEX FROM task_collaborator WHERE Key_name = 'ix_task_collaborator_task_id';"
).fetchone()

if is_index_2_exist:
return

op.create_index(
'ix_task_collaborator_task_id',
'task_collaborator',
Expand Down Expand Up @@ -97,6 +104,14 @@ def upgrade() -> None:
)

# Performances index
# check if the index is already exists
is_index_exist = op.execute(
"SHOW INDEX FROM task_sample_updater WHERE Key_name = 'ix_task_sample_updater_sample_id';"
).fetchone()

if is_index_exist:
return

op.create_index(
'ix_task_sample_updater_sample_id',
'task_sample_updater',
Expand Down
2 changes: 1 addition & 1 deletion labelu/internal/adapter/persistence/crud_pre_annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def list_by_task_id_and_file_id(db: Session, task_id: int, file_id: int) -> List
TaskPreAnnotation.file_id == file_id
).all()

def list_by_task_id_and_owner_id_and_sample_name(db: Session, task_id: int, owner_id: int, sample_name: str) -> List[TaskPreAnnotation]:
def list_by_task_id_and_owner_id_and_sample_name(db: Session, task_id: int, sample_name: str) -> List[TaskPreAnnotation]:
"""list pre annotations by task_id, owner_id and sample_name without pagination
Args:
Expand Down
4 changes: 0 additions & 4 deletions labelu/internal/domain/models/task_collaborator.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,3 @@ class TaskCollaborator(Base):
default=datetime.now,
comment="Time a task collaborator was created"
)

Index("ix_task_collaborator_task_id", task_id)
Index("ix_task_collaborator_user_id", user_id)
Index("ix_task_created_by_deleted_at", task_id, user_id)
3 changes: 0 additions & 3 deletions labelu/internal/domain/models/task_sample_updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,3 @@ class TaskSampleUpdater(Base):
nullable=False,
comment="created time"
)

Index("ix_task_sample_updater_sample_id", sample_id)
Index("ix_task_sample_updater_user_id", user_id)

0 comments on commit f917091

Please sign in to comment.