fix: output-completeness 檢查改用 per-library 路徑 — 修復 test library 誤報缺項
- 原本用全域 OUTPUT_DIR(demo) 檢查所有影片 - test 檔案的 json 在 output/test → 誤報 6 項 missing - 改用 get_output_dir_for_file(uuid) + global fallback
This commit is contained in:
+14
-2
@@ -935,7 +935,7 @@ struct OutputCompletenessItem {
|
||||
async fn get_output_completeness(
|
||||
State(state): State<AppState>,
|
||||
) -> Result<Json<serde_json::Value>, StatusCode> {
|
||||
let output_dir = crate::core::config::OUTPUT_DIR.to_string();
|
||||
let global_dir = crate::core::config::OUTPUT_DIR.as_str();
|
||||
let videos_table = schema::table_name("videos");
|
||||
|
||||
let rows: Vec<(String, String, String)> = sqlx::query_as(&format!(
|
||||
@@ -956,13 +956,25 @@ async fn get_output_completeness(
|
||||
continue; // 只檢查 completed 的影片
|
||||
}
|
||||
|
||||
// Per-library output dir with global fallback (test files live in output/test)
|
||||
let per_lib = crate::core::config::get_output_dir_for_file(&uuid, state.db.pool()).await;
|
||||
let output_dir = if std::path::Path::new(&per_lib).is_dir() {
|
||||
per_lib
|
||||
} else {
|
||||
global_dir.to_string()
|
||||
};
|
||||
|
||||
let mut missing = Vec::new();
|
||||
|
||||
// 檢查 JSON 產出
|
||||
for ext in ["asrx", "cut", "face", "face_cluster", "face_traced", "ocr", "scenes"] {
|
||||
let path = format!("{}/{}.{}.json", output_dir, uuid, ext);
|
||||
if !std::path::Path::new(&path).exists() {
|
||||
missing.push(format!("{}.json", ext));
|
||||
// fallback to global dir
|
||||
let global_path = format!("{}/{}.{}.json", global_dir, uuid, ext);
|
||||
if !std::path::Path::new(&global_path).exists() {
|
||||
missing.push(format!("{}.json", ext));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user