HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/projects/buyercall/buyercall/blueprints/workflows/utils/assigned_agents_collector.py
class WorkflowAssignedAgents:
    def __init__(self, workflow_actions=None):
        if workflow_actions is None:
            workflow_actions = {}
        self.actions = workflow_actions

    def get(self, key):
        assigned_entities = {
            "agentIds": [],
            "teamIds": []
        }
        for action in self.actions:
            if action.get('type', '') == key:
                agent_ids = [aid for aid in action['agentIds'] if aid]
                assigned_entities['agentIds'] = agent_ids
                team_ids = [tid for tid in action['teamIds'] if tid]
                assigned_entities['teamIds'] = team_ids

        return assigned_entities