Tournament Governor
import { tournamentGovernor } from 'tods-competition-factory';
addDrawDefinitionExtension
engine.addDrawDefinitionExtension({
extension: {
name: 'extension name',
value: {},
},
drawId,
});
addEventExtension
engine.addEventExtension({
extension: {
name: 'extension name',
value: {},
},
eventId,
});
addTimeItem
When calling via an engine, participant will be resolved from participantId, drawDefinitionwill be resovled fromdrawId, eventwill be resolved fromeventId, and tournamentRecord will be present. Method will only attach timeItem to one element.
engine.addTimeItem({
removePriorValues, // boolean; prior values with equivalent `itemType` will be removed
duplicateValues, // boolean; allow duplicate values
participantId, // optional; resolves to participant
creationTime, // optional timestamp adds `createdAt` value
timeItem, // required; { itemType, itemValue, itemSubTypes, itemDate }
eventId, // optional; resolves to event
drawId, // optional; resolves to drawDefinition
});
When calling directly without an engine. Attaches to first element encountered in params: element, drawDefinition, event, tournamentRecord.
addTimeItem({
removePriorValues, // boolean; prior values with equivalent `itemType` will be removed
tournamentRecord, // optional
duplicateValues, // boolean; allow duplicate values
drawDefinition, // optional
creationTime, // optional
timeItem, // required; { itemType, itemValue, itemSubTypes, itemDate }
element, // optional if event, drawDefinition or tournamentRecord provided
event, // optional
});
addOnlineResource
Attach an online resource to specified element. When no other ids are provided, will attach to tournamentRecord.
engine.addOnlineResource({
onlineResource, // required { identifier, resourceType, resourceSubType, ... }
organisationId, // optional
participantId, // optional
personId, // optional
courtId, // optional
venueId, // optional
eventId, // optional
drawId, // optional
});
addTournamentExtension
engine.addTournamentExtension({
extension: {
name: 'extension name',
value: {},
},
});
newTournamentRecord
Creates a new tournamentRecord in shared state.
engine.newTournamentRecord({
tournamentId, // optional - will be generated if not provided
});
const { tournamentRecord } = engine.getTournament();
orderCollectionDefinitions
Modify the array order of tieFormat.collectionDefinitions for an event, a drawDefinition, structure, or matchUp.
engine.orderCollectionDefinitions({
orderMap: { collectionId1: 1, collectionId2: 2 },
structureId, // required if modifying tieFormat for a structure
matchUpId, // required if modifying tieFormat for a matchUp
eventId, // required if modifying tieFormat for a event
drawId, // required if modifying tieFormat for a drawDefinition or a structure
});
removeOnlineResource
Remove an online resource from specified element. When no other ids are provided, will remove from tournamentRecord.
engine.removeOnlineResource({
onlineResource, // only requires { identifier, resourceType, resourceSubType }
organisationId, // optional
participantId, // optional
personId, // optional
courtId, // optional
venueId, // optional
eventId, // optional
drawId, // optional
});
removeTournamentExtension
engine.removeTournamentExtension({ name });
setTournamentCategories
Define categories to be used in event creation for tournament record.
const categories = [
{
type: eventConstants.AGE,
categoryName: 'U18',
},
{
type: eventConstants.AGE,
categoryName: 'U16',
},
{
type: eventConstants.RATING,
categoryName: 'WTN',
},
];
engine.setTournamentCategories({ categories });
setTournamentDates
Accepts an ISO String Date;
Set tournament startDate and endDate in one method call. Also cleans up matchUp schedules that are invalid due to date changes, and updates court dateAvailability.
engine.setTournamentDates({
activeDates, // optional array of dates from startDate to endDate
weekdays, // optional array of [MON, TUE, ...] // use { weekDayConstants }
startDate, // optional
endDate, // optional
});
setTournamentName
const tournamentName = 'CourtHive Challenge';
engine.setTournamentName({
tournamentName,
});
setTournamentNotes
engine.setTournamentNotes({ notes });
setTournamentStatus
engine.setTournamentStatus({ status: CANCELLED });