function sharedGroupCapacity
sharedGroupCapacity(
parentGroupIds: readonly number[],
childGroupIds: readonly number[],
staticCapByGroupId: ReadonlyMap<number, number>,
remainingByGroupId: ReadonlyMap<number, number>,
): SharedGroupCapacity

Build the SharedGroupCapacity for a parent/child pair from the PER-GROUP capacity maps (groupId → spots; uncapped groups omitted). They are co-grouped when their group sets intersect in at least one CAPPED group; when they are not, there is no shared cap (both facts undefined).

Both facts are the tightest value over the groups they SHARE — the pool(s) the combined demand actually contends for — NOT the child's tightest group overall. A child also in a tighter non-shared group must not pull the shared cap down to an unrelated group's value; the static cap and remaining are taken from the SAME shared groups so date-less surfaces reject a share too small to ever hold both even when a daily child's per-date remaining is unknown.

Parameters

parentGroupIds: readonly number[]
childGroupIds: readonly number[]
staticCapByGroupId: ReadonlyMap<number, number>
remainingByGroupId: ReadonlyMap<number, number>

Return Type

Usage

import { sharedGroupCapacity } from "docs/config.ts";