fix: ingestion-status shows all steps done when job is completed

When a job status is 'completed', all ingestion steps are marked as 'done'
regardless of node/edge counts. This fixes the UI showing pending steps
for completed jobs with 0 nodes/edges (e.g., videos with single speaker).
This commit is contained in:
Accusys
2026-07-06 22:08:11 +08:00
parent 3067896b0f
commit f56bdb7fbb
+13 -1
View File
@@ -590,11 +590,23 @@ async fn get_ingestion_status(
let strangers = strangers; let strangers = strangers;
// Check if job is completed - if so, all ingestion steps are considered done
let mj_table = schema::table_name("monitor_jobs");
let job_completed: bool = sqlx::query_scalar::<_, String>(&format!(
"SELECT status FROM {mj_table} WHERE uuid = $1"
))
.bind(&file_uuid)
.fetch_optional(pool)
.await
.unwrap_or(None)
.map(|s| s == "completed")
.unwrap_or(false);
macro_rules! step { macro_rules! step {
($name:expr, $done:expr, $detail:expr) => { ($name:expr, $done:expr, $detail:expr) => {
IngestionStep { IngestionStep {
name: $name.into(), name: $name.into(),
status: if $done { "done" } else { "pending" }.into(), status: if $done || job_completed { "done" } else { "pending" }.into(),
detail: $detail, detail: $detail,
} }
}; };