fix: avoid multiple paginated queries in metrics

This commit is contained in:
Esdras Renan 2025-11-18 20:08:30 -03:00
parent 744dcd1895
commit 4c25f3f83e

View file

@ -9,6 +9,7 @@ import {
fetchOpenScopedTickets,
fetchScopedTicketsByCreatedRange,
fetchScopedTicketsByResolvedRange,
fetchScopedTicketsByResolvedRangeSnapshot,
normalizeStatus,
} from "./reports"
import { requireStaff } from "./rbac"
@ -294,7 +295,7 @@ const metricResolvers: Record<string, MetricResolver> = {
queueIds,
)
const resolvedTickets = filterTicketsByQueue(
await fetchScopedTicketsByResolvedRange(ctx, tenantId, viewer, startMs, endMs, companyId),
await fetchScopedTicketsByResolvedRangeSnapshot(ctx, tenantId, viewer, startMs, endMs, companyId),
queueIds,
)