fix(annotation): 修改数据集文件状态查询逻辑

- 将文件状态查询从仅统计 ACTIVE 状态扩展为 ACTIVE 和 COMPLETED 状态
- 使用 in_ 操作符替代等于操作符以支持多状态查询
- 保持原有数据集标注计数功能不变
This commit is contained in:
2026-01-20 00:30:21 +08:00
parent d890a5679d
commit ea6765ea0f

View File

@@ -49,11 +49,11 @@ class DatasetMappingService:
Returns: Returns:
(total_count, annotated_count) 元组 (total_count, annotated_count) 元组
""" """
# 获取数据集总数据量(统计 ACTIVE 状态的文件) # 获取数据集总数据量(统计 ACTIVE 和 COMPLETED 状态的文件)
total_result = await self.db.execute( total_result = await self.db.execute(
select(func.count()).select_from(DatasetFiles).where( select(func.count()).select_from(DatasetFiles).where(
DatasetFiles.dataset_id == dataset_id, DatasetFiles.dataset_id == dataset_id,
DatasetFiles.status == "ACTIVE", DatasetFiles.status.in_(["ACTIVE", "COMPLETED"]),
) )
) )
total_count = int(total_result.scalar() or 0) total_count = int(total_result.scalar() or 0)