From 69f2c18febe449c9eb83fc213b41d8f18437918a Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Wed, 11 Dec 2024 12:39:52 +0100 Subject: [PATCH] Fix import of previously-deleted TRS workflow By returning latest, non-deleted workflow in `get_workflow_by_trs_id_and_version`. Fixes https://github.com/galaxyproject/galaxy/issues/19263 --- lib/galaxy/managers/workflows.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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):