From 9b4814a33ae247b9999b07e879397b3b1575b5d4 Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Tue, 20 Mar 2012 10:34:01 -0400 Subject: [PATCH] Fix owner_tag mapping of StoredWorkflow. Previously this mapping incorrectly retrieved *all* workflow tags owned by the user. --- lib/galaxy/model/mapping.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/galaxy/model/mapping.py b/lib/galaxy/model/mapping.py index 253c99073fb..e8fbcf36886 100644 --- a/lib/galaxy/model/mapping.py +++ b/lib/galaxy/model/mapping.py @@ -1566,7 +1566,7 @@ assign_mapper( context, WorkflowStepConnection, WorkflowStepConnection.table, assign_mapper( context, StoredWorkflow, StoredWorkflow.table, - properties=dict( user=relation( User, + properties=dict( user=relation( User, primaryjoin=( User.table.c.id == StoredWorkflow.table.c.user_id ), backref='stored_workflows' ), workflows=relation( Workflow, backref='stored_workflow', @@ -1575,16 +1575,15 @@ assign_mapper( context, StoredWorkflow, StoredWorkflow.table, latest_workflow=relation( Workflow, post_update=True, primaryjoin=( StoredWorkflow.table.c.latest_workflow_id == Workflow.table.c.id ), lazy=False ), - tags=relation( StoredWorkflowTagAssociation, order_by=StoredWorkflowTagAssociation.table.c.id, backref="stored_workflows" ), - owner_tags=relation( StoredWorkflowTagAssociation, + tags=relation( StoredWorkflowTagAssociation, order_by=StoredWorkflowTagAssociation.table.c.id, backref="stored_workflows" ), + owner_tags=relation( StoredWorkflowTagAssociation, primaryjoin=and_( StoredWorkflow.table.c.id == StoredWorkflowTagAssociation.table.c.stored_workflow_id, StoredWorkflow.table.c.user_id == StoredWorkflowTagAssociation.table.c.user_id ), - foreign_keys=[StoredWorkflowTagAssociation.table.c.user_id], order_by=StoredWorkflowTagAssociation.table.c.id ), annotations=relation( StoredWorkflowAnnotationAssociation, order_by=StoredWorkflowAnnotationAssociation.table.c.id, backref="stored_workflows" ), ratings=relation( StoredWorkflowRatingAssociation, order_by=StoredWorkflowRatingAssociation.table.c.id, backref="stored_workflows" ) ) ) - + # Set up proxy so that # StoredWorkflow.users_shared_with # returns a list of users that workflow is shared with.