diff --git a/lib/galaxy/managers/workflows.py b/lib/galaxy/managers/workflows.py index 20354c029198..c55d64067370 100644 --- a/lib/galaxy/managers/workflows.py +++ b/lib/galaxy/managers/workflows.py @@ -2083,6 +2083,7 @@ def to_json(column, keys: List[str]): .join(model.Workflow, model.Workflow.id == model.StoredWorkflow.latest_workflow_id) .filter( and_( + model.StoredWorkflow.deleted == false(), to_json(model.Workflow.source_metadata, ["trs_tool_id"]) == trs_id, to_json(model.Workflow.source_metadata, ["trs_version_id"]) == trs_version, ) @@ -2094,7 +2095,7 @@ def to_json(column, keys: List[str]): ) else: stmnt = stmnt.filter(model.StoredWorkflow.importable == true()) - return sa_session.execute(stmnt).scalar() + return sa_session.execute(stmnt.order_by(model.StoredWorkflow.id.desc()).limit(1)).scalar() class RefactorRequest(RefactorActions):