feat: Enable Capacity Config UI (#5164)
- Enables Capacity Config in UI - Rewrite auto assignment Logic to consider only online agents fixes: #4990
This commit is contained in:
@@ -23,8 +23,8 @@ module AssignmentHandler
|
||||
def find_assignee_from_team
|
||||
return if team&.allow_auto_assign.blank?
|
||||
|
||||
team_members = inbox.members.ids & team.members.ids
|
||||
::RoundRobin::AssignmentService.new(conversation: self, allowed_member_ids: team_members).find_assignee
|
||||
team_members_with_capacity = inbox.member_ids_with_assignment_capacity & team.members.ids
|
||||
::AutoAssignment::AgentAssignmentService.new(conversation: self, allowed_agent_ids: team_members_with_capacity).find_assignee
|
||||
end
|
||||
|
||||
def notify_assignment_change
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
module RoundRobinHandler
|
||||
module AutoAssignmentHandler
|
||||
extend ActiveSupport::Concern
|
||||
include Events::Types
|
||||
|
||||
included do
|
||||
after_save :run_round_robin
|
||||
after_save :run_auto_assignment
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def run_round_robin
|
||||
def run_auto_assignment
|
||||
# Round robin kicks in on conversation create & update
|
||||
# run it only when conversation status changes to open
|
||||
return unless conversation_status_changed_to_open?
|
||||
return unless should_round_robin?
|
||||
return unless should_run_auto_assignment?
|
||||
|
||||
::RoundRobin::AssignmentService.new(conversation: self, allowed_member_ids: inbox.member_ids_with_assignment_capacity).perform
|
||||
::AutoAssignment::AgentAssignmentService.new(conversation: self, allowed_agent_ids: inbox.member_ids_with_assignment_capacity).perform
|
||||
end
|
||||
|
||||
def should_round_robin?
|
||||
def should_run_auto_assignment?
|
||||
return false unless inbox.enable_auto_assignment?
|
||||
|
||||
# run only if assignee is blank or doesn't have access to inbox
|
||||
Reference in New Issue
Block a user