tieFormat Governor
import { tieFormatGovernor } from 'tods-competition-factory';
The tieFormatGovernor manages the creation, modification, validation, and storage optimisation of tieFormat objects, which define the structure and scoring rules for TEAM matchUps.
Introduction to tieFormats
In team competitions a single "tie" (or "dual match") consists of multiple individual matchUps — singles, doubles, and potentially mixed doubles — played between two teams. A tieFormat describes:
- What is played — the collections of singles and doubles matchUps (
collectionDefinitions) - How value is assigned — per-matchUp value, per-set value, per-collection value, or per-collection-position value profiles
- What it takes to win — a
winCriteriaobject specifying either avalueGoal(first to n) oraggregateValue(total score) - Optional groupings —
collectionGroupsthat bundle collections for group-level value thresholds (e.g. Laver Cup day scoring)
Structure
const tieFormat = {
tieFormatId: 'uuid', // optional — present when centrally stored
tieFormatName: 'My Format', // optional — human-readable label
winCriteria: {
valueGoal: 5, // OR aggregateValue: true
},
collectionDefinitions: [
{
collectionId: 'singles-id',
collectionName: 'Singles',
matchUpType: 'SINGLES',
matchUpCount: 6,
matchUpValue: 1, // one of: matchUpValue, setValue, scoreValue, collectionValue, collectionValueProfiles
matchUpFormat: 'SET3-S:6/TB7',
gender: 'MALE', // optional
category: {}, // optional
collectionGroupNumber: 1, // optional — links to a collectionGroup
},
// ...more collections
],
collectionGroups: [ // optional
{ groupNumber: 1, groupName: 'Day 1', groupValue: 3 },
],
};
Hierarchical Resolution
A tieFormat can be attached at four levels within a tournament record:
| Level | Property | Purpose |
|---|---|---|
| Event | event.tieFormat | Default for all draws in the event |
| DrawDefinition | drawDefinition.tieFormat | Overrides event default for one draw |
| Structure | structure.tieFormat | Overrides draw default for one structure (e.g. consolation) |
| MatchUp | matchUp.tieFormat | Overrides all ancestors for one specific matchUp |
When the factory resolves the active tieFormat for a matchUp it walks matchUp → structure → draw → event, returning the first one found. This means you only need to attach a tieFormat at a lower level when it differs from the ancestor default — for instance, shortening formats for rain-delayed matches.