fix(team-dashboard): agent-table buckets by authoritative agent.id

The Agent Performance table on the team dashboard was bucketing by raw
call.agentName — the field that holds Ozonetel's transfer-chain string
("RamaiahAdmin -> GlobalHealthX") and collides for distinct AgentIDs
that share a Full Name. Result: 7 rows for 3 real agents.

Now buckets by call.agent.id when the CDR enrichment has populated it,
falls back to legacy agentName grouping otherwise. Calls without any
agent info are dropped from the agent rollup (instead of being
collapsed under "Unknown").

Pulls agent { id name ozonetelAgentId } + transferredTo + transferType
on CALLS_QUERY.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-15 08:07:05 +05:30
parent d00b066806
commit 8de7d7d802
4 changed files with 33 additions and 8 deletions

View File

@@ -150,6 +150,10 @@ export function transformCalls(data: any): Call[] {
patientId: n.patientId,
appointmentId: n.appointmentId,
leadId: n.leadId,
agentId: n.agentId ?? null,
agent: n.agent ?? null,
transferredTo: n.transferredTo ?? null,
transferType: n.transferType ?? null,
}));
}