#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere
TypeScript dockerhacktoberfestjavapdfpdf-converterpdf-editorpdf-manipulationpdf-mergerpdf-ocrpdf-toolspdf-web-appspdfmergerself-hosted
import type { TeamHolding } from "@editor/billing/types";
/** Replaces this deployment's last report with its live roster, without counting it twice. */
export function fleetUsersInUse(
team: TeamHolding,
deviceId?: string | null,
localUsers?: number | null,
): number {
if (!team.breakdown) return team.usersInUse;
return team.breakdown.deployments.reduce(
(total, deployment) =>
total +
(deployment.deviceId === deviceId && localUsers != null
? localUsers
: (deployment.users ?? 0)),
team.breakdown.cloudUsers,
);
}