tods-competition-factory 0.83.1 → 0.83.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/tods-competition-factory.development.cjs.js +155 -149
- package/dist/tods-competition-factory.development.cjs.js.map +1 -1
- package/dist/tods-competition-factory.production.cjs.min.js +1 -1
- package/dist/tods-competition-factory.production.cjs.min.js.map +1 -1
- package/dist/tods-competition-factory.production.esm.min.js +1 -1
- package/dist/tods-competition-factory.production.esm.min.js.map +1 -1
- package/package.json +2 -2
|
@@ -249,7 +249,7 @@ const matchUpFormatCode = {
|
|
|
249
249
|
};
|
|
250
250
|
|
|
251
251
|
function factoryVersion() {
|
|
252
|
-
return '0.83.
|
|
252
|
+
return '0.83.2';
|
|
253
253
|
}
|
|
254
254
|
|
|
255
255
|
const FORMAT_STANDARD = 'SET3-S:6/TB7'; // Best of 3 Tiebreak Sets to 6
|
|
@@ -14372,7 +14372,7 @@ function validateScore({
|
|
|
14372
14372
|
};
|
|
14373
14373
|
|
|
14374
14374
|
if (sets !== null && sets !== void 0 && sets.length) {
|
|
14375
|
-
const setNumbers = sets.map(set => set === null || set === void 0 ? void 0 : set.setNumber);
|
|
14375
|
+
const setNumbers = sets.map(set => set === null || set === void 0 ? void 0 : set.setNumber).filter(Boolean);
|
|
14376
14376
|
if (setNumbers.length !== unique(setNumbers).length) return {
|
|
14377
14377
|
error: INVALID_VALUES,
|
|
14378
14378
|
message: 'setNumbers not unique'
|
|
@@ -22459,7 +22459,7 @@ const scaleConstants = {
|
|
|
22459
22459
|
};
|
|
22460
22460
|
|
|
22461
22461
|
function addParticipantContext(params) {
|
|
22462
|
-
var _params$
|
|
22462
|
+
var _params$tournamentPar;
|
|
22463
22463
|
|
|
22464
22464
|
const participantIdsWithConflicts = [];
|
|
22465
22465
|
const drawSizes = {};
|
|
@@ -22549,74 +22549,51 @@ function addParticipantContext(params) {
|
|
|
22549
22549
|
}
|
|
22550
22550
|
});
|
|
22551
22551
|
}
|
|
22552
|
-
});
|
|
22552
|
+
});
|
|
22553
22553
|
|
|
22554
|
-
(
|
|
22555
|
-
var
|
|
22554
|
+
if (params.withScheduleItems || params.scheduleAnalysis || params.withStatistics || params.withOpponents || params.withMatchUps || params.withEvents || params.withDraws) {
|
|
22555
|
+
var _params$tournamentEve;
|
|
22556
22556
|
|
|
22557
|
-
|
|
22558
|
-
|
|
22559
|
-
|
|
22560
|
-
eventName,
|
|
22561
|
-
eventType,
|
|
22562
|
-
category
|
|
22563
|
-
} = event;
|
|
22564
|
-
const eventInfo = {
|
|
22565
|
-
eventId,
|
|
22566
|
-
eventName,
|
|
22567
|
-
eventType,
|
|
22568
|
-
category
|
|
22569
|
-
};
|
|
22570
|
-
const extensionKeys = event && Object.keys(event).filter(key => key[0] === '_');
|
|
22571
|
-
extensionKeys === null || extensionKeys === void 0 ? void 0 : extensionKeys.forEach(extensionKey => eventInfo[extensionKey] = event[extensionKey]);
|
|
22572
|
-
const eventEntries = event.entries || []; // don't allow system extensions to be copied to participants
|
|
22557
|
+
// loop through all filtered events and capture events played
|
|
22558
|
+
(_params$tournamentEve = params.tournamentEvents) === null || _params$tournamentEve === void 0 ? void 0 : _params$tournamentEve.forEach(rawEvent => {
|
|
22559
|
+
var _event$drawDefinition, _eventInfo$_flightPro, _eventInfo$_flightPro2;
|
|
22573
22560
|
|
|
22574
|
-
|
|
22575
|
-
const disallowedKeys = disallowedConstants.map(constant => `_${constant}`);
|
|
22576
|
-
const filteredEventInfo = eventInfo && Object.keys(eventInfo).filter(key => !disallowedKeys.includes(key)).reduce((obj, key) => {
|
|
22577
|
-
obj[key] = eventInfo[key];
|
|
22578
|
-
return obj;
|
|
22579
|
-
}, {});
|
|
22580
|
-
eventEntries === null || eventEntries === void 0 ? void 0 : eventEntries.filter(entry => entry === null || entry === void 0 ? void 0 : entry.participantId).forEach(entry => {
|
|
22561
|
+
const event = makeDeepCopy(rawEvent, true, true);
|
|
22581
22562
|
const {
|
|
22582
|
-
|
|
22583
|
-
|
|
22584
|
-
|
|
22585
|
-
|
|
22586
|
-
} =
|
|
22587
|
-
|
|
22588
|
-
|
|
22589
|
-
|
|
22590
|
-
|
|
22591
|
-
|
|
22592
|
-
}
|
|
22593
|
-
|
|
22594
|
-
|
|
22595
|
-
|
|
22596
|
-
|
|
22563
|
+
eventId,
|
|
22564
|
+
eventName,
|
|
22565
|
+
eventType,
|
|
22566
|
+
category
|
|
22567
|
+
} = event;
|
|
22568
|
+
const eventInfo = {
|
|
22569
|
+
eventId,
|
|
22570
|
+
eventName,
|
|
22571
|
+
eventType,
|
|
22572
|
+
category
|
|
22573
|
+
};
|
|
22574
|
+
const extensionKeys = event && Object.keys(event).filter(key => key[0] === '_');
|
|
22575
|
+
extensionKeys === null || extensionKeys === void 0 ? void 0 : extensionKeys.forEach(extensionKey => eventInfo[extensionKey] = event[extensionKey]);
|
|
22576
|
+
const eventEntries = event.entries || []; // don't allow system extensions to be copied to participants
|
|
22577
|
+
|
|
22578
|
+
const disallowedConstants = [].concat(...Object.values(extensionConstants));
|
|
22579
|
+
const disallowedKeys = disallowedConstants.map(constant => `_${constant}`);
|
|
22580
|
+
const filteredEventInfo = eventInfo && Object.keys(eventInfo).filter(key => !disallowedKeys.includes(key)).reduce((obj, key) => {
|
|
22581
|
+
obj[key] = eventInfo[key];
|
|
22582
|
+
return obj;
|
|
22583
|
+
}, {});
|
|
22584
|
+
eventEntries === null || eventEntries === void 0 ? void 0 : eventEntries.filter(entry => entry === null || entry === void 0 ? void 0 : entry.participantId).forEach(entry => {
|
|
22585
|
+
const {
|
|
22586
|
+
participantId,
|
|
22597
22587
|
entryStage,
|
|
22598
|
-
|
|
22599
|
-
|
|
22600
|
-
|
|
22601
|
-
|
|
22588
|
+
entryStatus,
|
|
22589
|
+
entryPosition
|
|
22590
|
+
} = entry; // include all individual participants that are part of teams & pairs
|
|
22591
|
+
// relevantParticipantId is a reference to an individual
|
|
22602
22592
|
|
|
22603
|
-
|
|
22604
|
-
|
|
22605
|
-
|
|
22606
|
-
|
|
22607
|
-
drawType
|
|
22608
|
-
}) => {
|
|
22609
|
-
const {
|
|
22610
|
-
participantId,
|
|
22611
|
-
entryStage,
|
|
22612
|
-
entryStatus,
|
|
22613
|
-
entryPosition
|
|
22614
|
-
} = drawEntry;
|
|
22615
|
-
const relevantParticipantIds = getRelevantParticipantIds(participantId);
|
|
22616
|
-
relevantParticipantIds === null || relevantParticipantIds === void 0 ? void 0 : relevantParticipantIds.forEach(({
|
|
22617
|
-
relevantParticipantId
|
|
22618
|
-
}) => {
|
|
22619
|
-
if (!participantIdMap[relevantParticipantId].events[eventId]) {
|
|
22593
|
+
const relevantParticipantIds = getRelevantParticipantIds(participantId);
|
|
22594
|
+
relevantParticipantIds === null || relevantParticipantIds === void 0 ? void 0 : relevantParticipantIds.forEach(({
|
|
22595
|
+
relevantParticipantId
|
|
22596
|
+
}) => {
|
|
22620
22597
|
participantIdMap[relevantParticipantId].events[eventId] = { ...filteredEventInfo,
|
|
22621
22598
|
partnerParticipantIds: [],
|
|
22622
22599
|
entryPosition,
|
|
@@ -22624,102 +22601,131 @@ function addParticipantContext(params) {
|
|
|
22624
22601
|
entryStage,
|
|
22625
22602
|
drawIds: []
|
|
22626
22603
|
};
|
|
22627
|
-
}
|
|
22628
|
-
|
|
22629
|
-
if (!participantIdMap[relevantParticipantId].draws[drawId]) {
|
|
22630
|
-
var _drawSizes$drawId, _drawSizes$drawId2;
|
|
22604
|
+
});
|
|
22605
|
+
});
|
|
22631
22606
|
|
|
22632
|
-
|
|
22633
|
-
|
|
22634
|
-
|
|
22635
|
-
|
|
22636
|
-
|
|
22637
|
-
|
|
22638
|
-
|
|
22639
|
-
|
|
22640
|
-
|
|
22641
|
-
|
|
22642
|
-
|
|
22643
|
-
|
|
22644
|
-
|
|
22607
|
+
const addDrawData = ({
|
|
22608
|
+
drawId,
|
|
22609
|
+
drawEntry,
|
|
22610
|
+
drawName,
|
|
22611
|
+
drawType
|
|
22612
|
+
}) => {
|
|
22613
|
+
const {
|
|
22614
|
+
participantId,
|
|
22615
|
+
entryStage,
|
|
22616
|
+
entryStatus,
|
|
22617
|
+
entryPosition
|
|
22618
|
+
} = drawEntry;
|
|
22619
|
+
const relevantParticipantIds = getRelevantParticipantIds(participantId);
|
|
22620
|
+
relevantParticipantIds === null || relevantParticipantIds === void 0 ? void 0 : relevantParticipantIds.forEach(({
|
|
22621
|
+
relevantParticipantId
|
|
22622
|
+
}) => {
|
|
22623
|
+
if (!participantIdMap[relevantParticipantId].events[eventId]) {
|
|
22624
|
+
participantIdMap[relevantParticipantId].events[eventId] = { ...filteredEventInfo,
|
|
22625
|
+
partnerParticipantIds: [],
|
|
22626
|
+
entryPosition,
|
|
22627
|
+
entryStatus,
|
|
22628
|
+
entryStage,
|
|
22629
|
+
drawIds: []
|
|
22630
|
+
};
|
|
22631
|
+
}
|
|
22645
22632
|
|
|
22646
|
-
|
|
22633
|
+
if (!participantIdMap[relevantParticipantId].draws[drawId]) {
|
|
22634
|
+
var _drawSizes$drawId, _drawSizes$drawId2;
|
|
22635
|
+
|
|
22636
|
+
participantIdMap[relevantParticipantId].draws[drawId] = {
|
|
22637
|
+
qualifyingDrawSize: (_drawSizes$drawId = drawSizes[drawId]) === null || _drawSizes$drawId === void 0 ? void 0 : _drawSizes$drawId.qualifyingDrawSize,
|
|
22638
|
+
drawSize: (_drawSizes$drawId2 = drawSizes[drawId]) === null || _drawSizes$drawId2 === void 0 ? void 0 : _drawSizes$drawId2.drawSize,
|
|
22639
|
+
partnerParticipantIds: [],
|
|
22640
|
+
entryPosition,
|
|
22641
|
+
entryStatus,
|
|
22642
|
+
entryStage,
|
|
22643
|
+
drawName,
|
|
22644
|
+
drawType,
|
|
22645
|
+
eventId,
|
|
22646
|
+
drawId
|
|
22647
|
+
};
|
|
22648
|
+
}
|
|
22647
22649
|
|
|
22648
|
-
|
|
22649
|
-
participantIdMap[relevantParticipantId].events[eventId].drawIds.push(drawId);
|
|
22650
|
-
}
|
|
22651
|
-
});
|
|
22652
|
-
}; // iterate through flights to ensure that draw entries are captured if drawDefinitions have not yet been generated
|
|
22650
|
+
const eventDrawIds = participantIdMap[relevantParticipantId].events[eventId].drawIds;
|
|
22653
22651
|
|
|
22652
|
+
if (eventDrawIds && !(eventDrawIds !== null && eventDrawIds !== void 0 && eventDrawIds.includes(drawId))) {
|
|
22653
|
+
participantIdMap[relevantParticipantId].events[eventId].drawIds.push(drawId);
|
|
22654
|
+
}
|
|
22655
|
+
});
|
|
22656
|
+
}; // iterate through flights to ensure that draw entries are captured if drawDefinitions have not yet been generated
|
|
22654
22657
|
|
|
22655
|
-
const drawIdsWithDefinitions = ((_event$drawDefinition = event.drawDefinitions) === null || _event$drawDefinition === void 0 ? void 0 : _event$drawDefinition.map(({
|
|
22656
|
-
drawId
|
|
22657
|
-
}) => drawId)) || [];
|
|
22658
|
-
(_eventInfo$_flightPro = eventInfo._flightProfile) === null || _eventInfo$_flightPro === void 0 ? void 0 : (_eventInfo$_flightPro2 = _eventInfo$_flightPro.flights) === null || _eventInfo$_flightPro2 === void 0 ? void 0 : _eventInfo$_flightPro2.forEach(flight => {
|
|
22659
|
-
const {
|
|
22660
|
-
drawId,
|
|
22661
|
-
drawEntries
|
|
22662
|
-
} = flight;
|
|
22663
22658
|
|
|
22664
|
-
|
|
22665
|
-
|
|
22659
|
+
const drawIdsWithDefinitions = ((_event$drawDefinition = event.drawDefinitions) === null || _event$drawDefinition === void 0 ? void 0 : _event$drawDefinition.map(({
|
|
22660
|
+
drawId
|
|
22661
|
+
}) => drawId)) || [];
|
|
22662
|
+
(_eventInfo$_flightPro = eventInfo._flightProfile) === null || _eventInfo$_flightPro === void 0 ? void 0 : (_eventInfo$_flightPro2 = _eventInfo$_flightPro.flights) === null || _eventInfo$_flightPro2 === void 0 ? void 0 : _eventInfo$_flightPro2.forEach(flight => {
|
|
22663
|
+
const {
|
|
22666
22664
|
drawId,
|
|
22667
|
-
|
|
22668
|
-
}
|
|
22669
|
-
}
|
|
22670
|
-
});
|
|
22671
|
-
const {
|
|
22672
|
-
matchUps
|
|
22673
|
-
} = allEventMatchUps({
|
|
22674
|
-
tournamentRecord,
|
|
22675
|
-
nextMatchUps: true,
|
|
22676
|
-
inContext: true,
|
|
22677
|
-
event
|
|
22678
|
-
});
|
|
22679
|
-
const drawDetails = Object.assign({}, ...(event.drawDefinitions || []).map(drawDefinition => {
|
|
22680
|
-
var _getPositionAssignmen, _getPositionAssignmen2, _getPositionAssignmen3, _getPositionAssignmen4;
|
|
22665
|
+
drawEntries
|
|
22666
|
+
} = flight;
|
|
22681
22667
|
|
|
22682
|
-
|
|
22683
|
-
|
|
22684
|
-
|
|
22685
|
-
|
|
22686
|
-
|
|
22687
|
-
|
|
22688
|
-
const mainStructure = getDrawStructures({
|
|
22689
|
-
stageSequence: 1,
|
|
22690
|
-
drawDefinition,
|
|
22691
|
-
stage: MAIN
|
|
22668
|
+
if (!drawIdsWithDefinitions.includes(drawId)) {
|
|
22669
|
+
drawEntries === null || drawEntries === void 0 ? void 0 : drawEntries.forEach(drawEntry => addDrawData({
|
|
22670
|
+
drawId,
|
|
22671
|
+
drawEntry
|
|
22672
|
+
}));
|
|
22673
|
+
}
|
|
22692
22674
|
});
|
|
22693
|
-
const
|
|
22694
|
-
|
|
22695
|
-
}
|
|
22696
|
-
|
|
22697
|
-
|
|
22698
|
-
|
|
22699
|
-
|
|
22675
|
+
const {
|
|
22676
|
+
matchUps
|
|
22677
|
+
} = allEventMatchUps({
|
|
22678
|
+
tournamentRecord,
|
|
22679
|
+
nextMatchUps: true,
|
|
22680
|
+
inContext: true,
|
|
22681
|
+
event
|
|
22700
22682
|
});
|
|
22701
|
-
const
|
|
22702
|
-
|
|
22703
|
-
|
|
22704
|
-
|
|
22705
|
-
|
|
22706
|
-
|
|
22707
|
-
|
|
22708
|
-
|
|
22709
|
-
|
|
22710
|
-
|
|
22711
|
-
|
|
22712
|
-
|
|
22713
|
-
|
|
22714
|
-
|
|
22715
|
-
|
|
22716
|
-
|
|
22717
|
-
|
|
22718
|
-
|
|
22719
|
-
|
|
22720
|
-
|
|
22683
|
+
const drawDetails = Object.assign({}, ...(event.drawDefinitions || []).map(drawDefinition => {
|
|
22684
|
+
var _getPositionAssignmen, _getPositionAssignmen2, _getPositionAssignmen3, _getPositionAssignmen4;
|
|
22685
|
+
|
|
22686
|
+
const entriesMap = Object.assign({}, ...eventEntries.filter(entry => entry.participantId).map(entry => ({
|
|
22687
|
+
[entry.participantId]: entry
|
|
22688
|
+
})), ...drawDefinition.entries.filter(entry => entry.participantId).map(entry => ({
|
|
22689
|
+
[entry.participantId]: entry
|
|
22690
|
+
})));
|
|
22691
|
+
const drawEntries = Object.values(entriesMap);
|
|
22692
|
+
const mainStructure = getDrawStructures({
|
|
22693
|
+
stageSequence: 1,
|
|
22694
|
+
drawDefinition,
|
|
22695
|
+
stage: MAIN
|
|
22696
|
+
});
|
|
22697
|
+
const drawSize = mainStructure && ((_getPositionAssignmen = getPositionAssignments$1({
|
|
22698
|
+
structure: mainStructure
|
|
22699
|
+
})) === null || _getPositionAssignmen === void 0 ? void 0 : (_getPositionAssignmen2 = _getPositionAssignmen.positionAssignments) === null || _getPositionAssignmen2 === void 0 ? void 0 : _getPositionAssignmen2.length);
|
|
22700
|
+
const qualifyingStructure = getDrawStructures({
|
|
22701
|
+
stageSequence: 1,
|
|
22702
|
+
drawDefinition,
|
|
22703
|
+
stage: QUALIFYING
|
|
22704
|
+
});
|
|
22705
|
+
const qualifyingDrawSize = mainStructure && ((_getPositionAssignmen3 = getPositionAssignments$1({
|
|
22706
|
+
structure: qualifyingStructure
|
|
22707
|
+
})) === null || _getPositionAssignmen3 === void 0 ? void 0 : (_getPositionAssignmen4 = _getPositionAssignmen3.positionAssignments) === null || _getPositionAssignmen4 === void 0 ? void 0 : _getPositionAssignmen4.length);
|
|
22708
|
+
drawSizes[drawDefinition.drawId] = {
|
|
22709
|
+
drawSize,
|
|
22710
|
+
qualifyingDrawSize
|
|
22711
|
+
};
|
|
22712
|
+
return {
|
|
22713
|
+
[drawDefinition.drawId]: {
|
|
22714
|
+
drawType: drawDefinition.drawType,
|
|
22715
|
+
drawEntries
|
|
22716
|
+
}
|
|
22717
|
+
};
|
|
22718
|
+
}));
|
|
22719
|
+
matchUps === null || matchUps === void 0 ? void 0 : matchUps.forEach(matchUp => processMatchUp({
|
|
22720
|
+
matchUp,
|
|
22721
|
+
drawDetails,
|
|
22722
|
+
eventType
|
|
22723
|
+
}));
|
|
22724
|
+
});
|
|
22725
|
+
} // tournamentParticipants is an array of FILTERED participants
|
|
22721
22726
|
// whereas allTournamentParticipants = params.tournamentRecord.participants
|
|
22722
22727
|
|
|
22728
|
+
|
|
22723
22729
|
(_params$tournamentPar = params.tournamentParticipants) === null || _params$tournamentPar === void 0 ? void 0 : _params$tournamentPar.forEach(participant => {
|
|
22724
22730
|
const {
|
|
22725
22731
|
scheduleConflicts,
|