diff --git a/config/features.yml b/config/features.yml index 942eda32e..ba1ec6185 100644 --- a/config/features.yml +++ b/config/features.yml @@ -191,10 +191,10 @@ display_name: CRM V2 enabled: false chatwoot_internal: true -- name: assignment_v2 - display_name: Assignment V2 - enabled: false - chatwoot_internal: true - name: twilio_content_templates display_name: Twilio Content Templates enabled: false +- name: assignment_v2 + display_name: Assignment V2 + enabled: false + chatwoot_internal: false diff --git a/enterprise/app/services/enterprise/auto_assignment/capacity_service.rb b/enterprise/app/services/enterprise/auto_assignment/capacity_service.rb index 5baabb8c6..f82da9267 100644 --- a/enterprise/app/services/enterprise/auto_assignment/capacity_service.rb +++ b/enterprise/app/services/enterprise/auto_assignment/capacity_service.rb @@ -22,23 +22,4 @@ class Enterprise::AutoAssignment::CapacityService # Agent has capacity if current count is below the limit current_count < inbox_limit.conversation_limit end - - def agent_capacity_status(user, inbox) - account_user = user.account_users.find_by(account: inbox.account) - return { has_capacity: true, current: 0, limit: nil } unless account_user&.agent_capacity_policy - - policy = account_user.agent_capacity_policy - inbox_limit = policy.inbox_capacity_limits.find_by(inbox: inbox) - return { has_capacity: true, current: 0, limit: nil } unless inbox_limit - - current_count = user.assigned_conversations - .where(inbox: inbox, status: :open) - .count - - { - has_capacity: current_count < inbox_limit.conversation_limit, - current: current_count, - limit: inbox_limit.conversation_limit - } - end end diff --git a/spec/enterprise/auto_assignment/capacity_service_spec.rb b/spec/enterprise/auto_assignment/capacity_service_spec.rb index f0b6ea11b..b945f5140 100644 --- a/spec/enterprise/auto_assignment/capacity_service_spec.rb +++ b/spec/enterprise/auto_assignment/capacity_service_spec.rb @@ -64,6 +64,7 @@ RSpec.describe Enterprise::AutoAssignment::CapacityService, type: :service do describe 'capacity filtering' do it 'excludes agents at capacity' do # Get available agents respecting capacity + capacity_service = described_class.new online_agents = inbox.available_agents filtered_agents = online_agents.select do |inbox_member| capacity_service.agent_has_capacity?(inbox_member.user, inbox) @@ -111,32 +112,4 @@ RSpec.describe Enterprise::AutoAssignment::CapacityService, type: :service do expect(conversation2.reload.assignee).to eq(agent_without_capacity) end end - - describe 'capacity status' do - it 'provides accurate capacity status for agent at capacity' do - capacity_service = described_class.new - status = capacity_service.agent_capacity_status(agent_at_capacity, inbox) - - expect(status[:has_capacity]).to be false - expect(status[:current]).to eq(3) - expect(status[:limit]).to eq(3) - end - - it 'provides accurate capacity status for agent with capacity' do - capacity_service = described_class.new - status = capacity_service.agent_capacity_status(agent_with_capacity, inbox) - - expect(status[:has_capacity]).to be true - expect(status[:current]).to eq(0) - expect(status[:limit]).to eq(3) - end - - it 'provides accurate capacity status for agent without limit' do - capacity_service = described_class.new - status = capacity_service.agent_capacity_status(agent_without_capacity, inbox) - - expect(status[:has_capacity]).to be true - expect(status[:limit]).to be_nil - end - end end