fix: resolve NameError from undefined has_filtered in list_unified_data

list_unified_data() referenced has_filtered which was never defined
and does not exist on RawDataFolder model. Replace all three
references with has_pkl, which is the correctly computed variable
tracking processed PKL file existence.

Fixes runtime crash when accessing /admin/data/unified endpoint.
This commit is contained in:
yilv committed 2026-07-06 16:15:41 +08:00
1 parent 2a447e55b0
commit d83dbfd96d
1 file changed
+3 -3
+3 -3
View File
@@ -5257,7 +5257,7 @@ def list_unified_data():
elif has_pkl:
actual_status = 'processing' # 已处理但未推理,使用 processing 匹配前端选项
if folder.status == "unprocessed" and not has_filtered and not has_pkl:
if folder.status == "unprocessed" and not has_pkl:
# 纯原始数据
item = {
"id": folder.id,
@@ -5281,7 +5281,7 @@ def list_unified_data():
# 有处理过的数据 - data_status 反映数据处理进度
if has_inference:
data_status = "completed" # 已推理完成
elif has_filtered or has_pkl:
elif has_pkl:
data_status = "processing" # 处理中(已滤波但未推理)
elif raw_file_count > 0:
data_status = "raw" # 只有原始数据
@@ -5302,7 +5302,7 @@ def list_unified_data():
"researcher_name": folder.researcher.username if folder.researcher else None,
"folder_tag": folder.folder_tag,
"file_count": file_count,
"has_filtered": has_filtered,
"has_pkl": has_pkl,
"has_pkl": has_pkl,
"has_inference": has_inference,
"last_processed": folder.last_processed.isoformat() if folder.last_processed else None,