feat(capacity): per-agent ticket capacity tracking#66
Merged
Conversation
Port agent capacity from the Laravel reference. Adds an AgentCapacity model + table (per agent, per channel: a configurable max_concurrent ceiling and a running current_count, unique on user_id+channel) with pure has_capacity / load_percentage helpers, and a CapacityService that creates rows on demand (default ceiling 10) and increments/decrements load, plus can_accept_ticket() so routing can avoid overloading agents.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ports agent capacity from the Laravel reference, continuing the cross-backend parity sweep. (WordPress was one of two backends still missing this domain.)
What
AgentCapacitymodel + table (escalated_agent_capacityvia dbDelta): per agent, per channel — a configurablemax_concurrentceiling (default 10) and a runningcurrent_count, unique on(user_id, channel). Purehas_capacity()/load_percentage()helpers plus$wpdbCRUD,find_or_create(), andincrement()/decrement()(never below zero).CapacityService— mirrors the LaravelCapacityService:can_accept_ticket(),increment_load(),decrement_load(),all_capacities().Verification
php -lclean on all files.vendor/bin/pint --test(the lint CI gate) passes on all changed files.Test_Capacity_Service— pure tests forhas_capacity/load_percentage+ a live-wpdb flow test (fill to ceiling → blocked → release → free; decrement floors at zero). Runs in CI against the WP test harness.