summaryrefslogtreecommitdiff
path: root/makima/src/db
diff options
context:
space:
mode:
Diffstat (limited to 'makima/src/db')
-rw-r--r--makima/src/db/repository.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/makima/src/db/repository.rs b/makima/src/db/repository.rs
index 358ab48..7afbeea 100644
--- a/makima/src/db/repository.rs
+++ b/makima/src/db/repository.rs
@@ -5371,6 +5371,12 @@ pub async fn advance_directive_ready_steps(
JOIN directive_steps ds ON ds.id = dep_id
WHERE ds.status NOT IN ('completed', 'skipped')
)
+ AND NOT EXISTS (
+ SELECT 1 FROM directive_steps prev
+ WHERE prev.directive_id = $1
+ AND prev.order_index < directive_steps.order_index
+ AND prev.status NOT IN ('completed', 'skipped', 'failed')
+ )
RETURNING *
"#,
)