mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-18 12:05:05 +00:00
17 lines
431 B
Ruby
17 lines
431 B
Ruby
class AutoAssignment::RoundRobinSelector
|
|
pattr_initialize [:inbox!]
|
|
|
|
def select_agent(available_agents)
|
|
return nil if available_agents.empty?
|
|
|
|
agent_user_ids = available_agents.map(&:user_id).map(&:to_s)
|
|
round_robin_service.available_agent(allowed_agent_ids: agent_user_ids)
|
|
end
|
|
|
|
private
|
|
|
|
def round_robin_service
|
|
@round_robin_service ||= AutoAssignment::InboxRoundRobinService.new(inbox: inbox)
|
|
end
|
|
end
|