tods-competition-factory 0.81.0 → 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 +208 -181
- 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 +6 -6
|
@@ -249,7 +249,7 @@ const matchUpFormatCode = {
|
|
|
249
249
|
};
|
|
250
250
|
|
|
251
251
|
function factoryVersion() {
|
|
252
|
-
return '0.
|
|
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
|
|
@@ -11694,12 +11694,12 @@ function getAllStructureMatchUps({
|
|
|
11694
11694
|
matchUp,
|
|
11695
11695
|
event
|
|
11696
11696
|
}) {
|
|
11697
|
-
var _roundNamingProfile$r, _roundNamingProfile$r2, _roundProfile$roundNu, _roundProfile$roundNu2, _roundProfile$roundNu3;
|
|
11697
|
+
var _roundNamingProfile$r, _roundNamingProfile$r2, _roundProfile$roundNu, _roundProfile$roundNu2, _roundProfile$roundNu3, _matchUp$score;
|
|
11698
11698
|
|
|
11699
11699
|
const tieFormat = matchUp.tieFormat || structure.tieFormat || (drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.tieFormat) || (event === null || event === void 0 ? void 0 : event.tieFormat) || undefined;
|
|
11700
11700
|
const collectionDefinitions = tieFormat === null || tieFormat === void 0 ? void 0 : tieFormat.collectionDefinitions;
|
|
11701
11701
|
const collectionDefinition = matchUp.collectionId && (collectionDefinitions === null || collectionDefinitions === void 0 ? void 0 : collectionDefinitions.find(definition => definition.collectionId === matchUp.collectionId));
|
|
11702
|
-
const matchUpFormat = matchUp.
|
|
11702
|
+
const matchUpFormat = matchUp.collectionId ? collectionDefinition && collectionDefinition.matchUpFormat : matchUp.matchUpFormat || structure.matchUpFormat || (drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.matchUpFormat) || (event === null || event === void 0 ? void 0 : event.matchUpFormat);
|
|
11703
11703
|
const matchUpType = matchUp.matchUpType || (collectionDefinition === null || collectionDefinition === void 0 ? void 0 : collectionDefinition.matchUpType) || structure.matchUpType || (drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.matchUpType) || (event === null || event === void 0 ? void 0 : event.eventType) !== TEAM$2 && (event === null || event === void 0 ? void 0 : event.eventType);
|
|
11704
11704
|
const matchUpStatus = isCollectionBye ? BYE : matchUp.matchUpStatus;
|
|
11705
11705
|
const {
|
|
@@ -11768,6 +11768,29 @@ function getAllStructureMatchUps({
|
|
|
11768
11768
|
stage
|
|
11769
11769
|
}), makeDeepCopy(onlyDefined(matchUp), true, true));
|
|
11770
11770
|
|
|
11771
|
+
if (matchUpFormat && (_matchUp$score = matchUp.score) !== null && _matchUp$score !== void 0 && _matchUp$score.scoreStringSide1) {
|
|
11772
|
+
const parsedFormat = parse(matchUpFormat);
|
|
11773
|
+
const {
|
|
11774
|
+
bestOf,
|
|
11775
|
+
finalSetFormat,
|
|
11776
|
+
setFormat
|
|
11777
|
+
} = parsedFormat || {};
|
|
11778
|
+
|
|
11779
|
+
if (finalSetFormat !== null && finalSetFormat !== void 0 && finalSetFormat.tiebreakSet || setFormat !== null && setFormat !== void 0 && setFormat.tiebreakSet || setFormat !== null && setFormat !== void 0 && setFormat.timed) {
|
|
11780
|
+
matchUpWithContext.score.sets = matchUpWithContext.score.sets.sort((a, b) => a.setNumber - b.setNumber).map((set, i) => {
|
|
11781
|
+
const setNumber = i + 1;
|
|
11782
|
+
|
|
11783
|
+
if (setNumber === bestOf) {
|
|
11784
|
+
if (finalSetFormat !== null && finalSetFormat !== void 0 && finalSetFormat.tiebreakSet || finalSetFormat !== null && finalSetFormat !== void 0 && finalSetFormat.timed) set.tiebreakSet = true;
|
|
11785
|
+
} else {
|
|
11786
|
+
if (setFormat !== null && setFormat !== void 0 && setFormat.tiebreakSet || setFormat !== null && setFormat !== void 0 && setFormat.timed) set.tiebreakSet = true;
|
|
11787
|
+
}
|
|
11788
|
+
|
|
11789
|
+
return set;
|
|
11790
|
+
});
|
|
11791
|
+
}
|
|
11792
|
+
}
|
|
11793
|
+
|
|
11771
11794
|
if (Array.isArray(drawPositions)) {
|
|
11772
11795
|
const {
|
|
11773
11796
|
orderedDrawPositions,
|
|
@@ -14349,7 +14372,7 @@ function validateScore({
|
|
|
14349
14372
|
};
|
|
14350
14373
|
|
|
14351
14374
|
if (sets !== null && sets !== void 0 && sets.length) {
|
|
14352
|
-
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);
|
|
14353
14376
|
if (setNumbers.length !== unique(setNumbers).length) return {
|
|
14354
14377
|
error: INVALID_VALUES,
|
|
14355
14378
|
message: 'setNumbers not unique'
|
|
@@ -22436,7 +22459,7 @@ const scaleConstants = {
|
|
|
22436
22459
|
};
|
|
22437
22460
|
|
|
22438
22461
|
function addParticipantContext(params) {
|
|
22439
|
-
var _params$
|
|
22462
|
+
var _params$tournamentPar;
|
|
22440
22463
|
|
|
22441
22464
|
const participantIdsWithConflicts = [];
|
|
22442
22465
|
const drawSizes = {};
|
|
@@ -22526,74 +22549,51 @@ function addParticipantContext(params) {
|
|
|
22526
22549
|
}
|
|
22527
22550
|
});
|
|
22528
22551
|
}
|
|
22529
|
-
});
|
|
22552
|
+
});
|
|
22530
22553
|
|
|
22531
|
-
(
|
|
22532
|
-
var
|
|
22554
|
+
if (params.withScheduleItems || params.scheduleAnalysis || params.withStatistics || params.withOpponents || params.withMatchUps || params.withEvents || params.withDraws) {
|
|
22555
|
+
var _params$tournamentEve;
|
|
22533
22556
|
|
|
22534
|
-
|
|
22535
|
-
|
|
22536
|
-
|
|
22537
|
-
eventName,
|
|
22538
|
-
eventType,
|
|
22539
|
-
category
|
|
22540
|
-
} = event;
|
|
22541
|
-
const eventInfo = {
|
|
22542
|
-
eventId,
|
|
22543
|
-
eventName,
|
|
22544
|
-
eventType,
|
|
22545
|
-
category
|
|
22546
|
-
};
|
|
22547
|
-
const extensionKeys = event && Object.keys(event).filter(key => key[0] === '_');
|
|
22548
|
-
extensionKeys === null || extensionKeys === void 0 ? void 0 : extensionKeys.forEach(extensionKey => eventInfo[extensionKey] = event[extensionKey]);
|
|
22549
|
-
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;
|
|
22550
22560
|
|
|
22551
|
-
|
|
22552
|
-
const disallowedKeys = disallowedConstants.map(constant => `_${constant}`);
|
|
22553
|
-
const filteredEventInfo = eventInfo && Object.keys(eventInfo).filter(key => !disallowedKeys.includes(key)).reduce((obj, key) => {
|
|
22554
|
-
obj[key] = eventInfo[key];
|
|
22555
|
-
return obj;
|
|
22556
|
-
}, {});
|
|
22557
|
-
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);
|
|
22558
22562
|
const {
|
|
22559
|
-
|
|
22560
|
-
|
|
22561
|
-
|
|
22562
|
-
|
|
22563
|
-
} =
|
|
22564
|
-
|
|
22565
|
-
|
|
22566
|
-
|
|
22567
|
-
|
|
22568
|
-
|
|
22569
|
-
}
|
|
22570
|
-
|
|
22571
|
-
|
|
22572
|
-
|
|
22573
|
-
|
|
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,
|
|
22574
22587
|
entryStage,
|
|
22575
|
-
|
|
22576
|
-
|
|
22577
|
-
|
|
22578
|
-
|
|
22588
|
+
entryStatus,
|
|
22589
|
+
entryPosition
|
|
22590
|
+
} = entry; // include all individual participants that are part of teams & pairs
|
|
22591
|
+
// relevantParticipantId is a reference to an individual
|
|
22579
22592
|
|
|
22580
|
-
|
|
22581
|
-
|
|
22582
|
-
|
|
22583
|
-
|
|
22584
|
-
drawType
|
|
22585
|
-
}) => {
|
|
22586
|
-
const {
|
|
22587
|
-
participantId,
|
|
22588
|
-
entryStage,
|
|
22589
|
-
entryStatus,
|
|
22590
|
-
entryPosition
|
|
22591
|
-
} = drawEntry;
|
|
22592
|
-
const relevantParticipantIds = getRelevantParticipantIds(participantId);
|
|
22593
|
-
relevantParticipantIds === null || relevantParticipantIds === void 0 ? void 0 : relevantParticipantIds.forEach(({
|
|
22594
|
-
relevantParticipantId
|
|
22595
|
-
}) => {
|
|
22596
|
-
if (!participantIdMap[relevantParticipantId].events[eventId]) {
|
|
22593
|
+
const relevantParticipantIds = getRelevantParticipantIds(participantId);
|
|
22594
|
+
relevantParticipantIds === null || relevantParticipantIds === void 0 ? void 0 : relevantParticipantIds.forEach(({
|
|
22595
|
+
relevantParticipantId
|
|
22596
|
+
}) => {
|
|
22597
22597
|
participantIdMap[relevantParticipantId].events[eventId] = { ...filteredEventInfo,
|
|
22598
22598
|
partnerParticipantIds: [],
|
|
22599
22599
|
entryPosition,
|
|
@@ -22601,102 +22601,131 @@ function addParticipantContext(params) {
|
|
|
22601
22601
|
entryStage,
|
|
22602
22602
|
drawIds: []
|
|
22603
22603
|
};
|
|
22604
|
-
}
|
|
22605
|
-
|
|
22606
|
-
if (!participantIdMap[relevantParticipantId].draws[drawId]) {
|
|
22607
|
-
var _drawSizes$drawId, _drawSizes$drawId2;
|
|
22604
|
+
});
|
|
22605
|
+
});
|
|
22608
22606
|
|
|
22609
|
-
|
|
22610
|
-
|
|
22611
|
-
|
|
22612
|
-
|
|
22613
|
-
|
|
22614
|
-
|
|
22615
|
-
|
|
22616
|
-
|
|
22617
|
-
|
|
22618
|
-
|
|
22619
|
-
|
|
22620
|
-
|
|
22621
|
-
|
|
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
|
+
}
|
|
22622
22632
|
|
|
22623
|
-
|
|
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
|
+
}
|
|
22624
22649
|
|
|
22625
|
-
|
|
22626
|
-
participantIdMap[relevantParticipantId].events[eventId].drawIds.push(drawId);
|
|
22627
|
-
}
|
|
22628
|
-
});
|
|
22629
|
-
}; // 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;
|
|
22630
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
|
|
22631
22657
|
|
|
22632
|
-
const drawIdsWithDefinitions = ((_event$drawDefinition = event.drawDefinitions) === null || _event$drawDefinition === void 0 ? void 0 : _event$drawDefinition.map(({
|
|
22633
|
-
drawId
|
|
22634
|
-
}) => drawId)) || [];
|
|
22635
|
-
(_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 => {
|
|
22636
|
-
const {
|
|
22637
|
-
drawId,
|
|
22638
|
-
drawEntries
|
|
22639
|
-
} = flight;
|
|
22640
22658
|
|
|
22641
|
-
|
|
22642
|
-
|
|
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 {
|
|
22643
22664
|
drawId,
|
|
22644
|
-
|
|
22645
|
-
}
|
|
22646
|
-
}
|
|
22647
|
-
});
|
|
22648
|
-
const {
|
|
22649
|
-
matchUps
|
|
22650
|
-
} = allEventMatchUps({
|
|
22651
|
-
tournamentRecord,
|
|
22652
|
-
nextMatchUps: true,
|
|
22653
|
-
inContext: true,
|
|
22654
|
-
event
|
|
22655
|
-
});
|
|
22656
|
-
const drawDetails = Object.assign({}, ...(event.drawDefinitions || []).map(drawDefinition => {
|
|
22657
|
-
var _getPositionAssignmen, _getPositionAssignmen2, _getPositionAssignmen3, _getPositionAssignmen4;
|
|
22665
|
+
drawEntries
|
|
22666
|
+
} = flight;
|
|
22658
22667
|
|
|
22659
|
-
|
|
22660
|
-
|
|
22661
|
-
|
|
22662
|
-
|
|
22663
|
-
|
|
22664
|
-
|
|
22665
|
-
const mainStructure = getDrawStructures({
|
|
22666
|
-
stageSequence: 1,
|
|
22667
|
-
drawDefinition,
|
|
22668
|
-
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
|
+
}
|
|
22669
22674
|
});
|
|
22670
|
-
const
|
|
22671
|
-
|
|
22672
|
-
}
|
|
22673
|
-
|
|
22674
|
-
|
|
22675
|
-
|
|
22676
|
-
|
|
22675
|
+
const {
|
|
22676
|
+
matchUps
|
|
22677
|
+
} = allEventMatchUps({
|
|
22678
|
+
tournamentRecord,
|
|
22679
|
+
nextMatchUps: true,
|
|
22680
|
+
inContext: true,
|
|
22681
|
+
event
|
|
22677
22682
|
});
|
|
22678
|
-
const
|
|
22679
|
-
|
|
22680
|
-
|
|
22681
|
-
|
|
22682
|
-
|
|
22683
|
-
|
|
22684
|
-
|
|
22685
|
-
|
|
22686
|
-
|
|
22687
|
-
|
|
22688
|
-
|
|
22689
|
-
|
|
22690
|
-
|
|
22691
|
-
|
|
22692
|
-
|
|
22693
|
-
|
|
22694
|
-
|
|
22695
|
-
|
|
22696
|
-
|
|
22697
|
-
|
|
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
|
|
22698
22726
|
// whereas allTournamentParticipants = params.tournamentRecord.participants
|
|
22699
22727
|
|
|
22728
|
+
|
|
22700
22729
|
(_params$tournamentPar = params.tournamentParticipants) === null || _params$tournamentPar === void 0 ? void 0 : _params$tournamentPar.forEach(participant => {
|
|
22701
22730
|
const {
|
|
22702
22731
|
scheduleConflicts,
|
|
@@ -22998,10 +23027,15 @@ function annotateParticipant({
|
|
|
22998
23027
|
if (scaleItems !== null && scaleItems !== void 0 && scaleItems.length) {
|
|
22999
23028
|
const latestScaleItem = scaleType => scaleItems.filter(timeItem => (timeItem === null || timeItem === void 0 ? void 0 : timeItem.itemType) === scaleType).sort((a, b) => new Date(a.createdAt || undefined) - new Date(b.createdAt || undefined)).pop();
|
|
23000
23029
|
|
|
23001
|
-
|
|
23030
|
+
const itemTypes = unique(scaleItems.map(({
|
|
23002
23031
|
itemType
|
|
23003
|
-
}) => itemType))
|
|
23004
|
-
|
|
23032
|
+
}) => itemType));
|
|
23033
|
+
participant.rankings = undefined; // ensure no server-side persisted context
|
|
23034
|
+
|
|
23035
|
+
participant.ratings = undefined; // ensure no server-side persisted context
|
|
23036
|
+
|
|
23037
|
+
for (const itemType of itemTypes) {
|
|
23038
|
+
const scaleItem = latestScaleItem(itemType);
|
|
23005
23039
|
|
|
23006
23040
|
if (scaleItem) {
|
|
23007
23041
|
const [, type, format, scaleName] = scaleItem.itemType.split('.');
|
|
@@ -23408,7 +23442,7 @@ function getTournamentParticipants({
|
|
|
23408
23442
|
participantFilters,
|
|
23409
23443
|
participants: tournamentParticipants
|
|
23410
23444
|
});
|
|
23411
|
-
const addContext = withScheduleItems || scheduleAnalysis || withStatistics || withGroupings || withOpponents || withMatchUps || withEvents || withDraws || withISO
|
|
23445
|
+
const addContext = withScheduleItems || scheduleAnalysis || withStatistics || withGroupings || withOpponents || withMatchUps || withEvents || withDraws || withISO;
|
|
23412
23446
|
let participantIdsWithConflicts;
|
|
23413
23447
|
|
|
23414
23448
|
if (addContext) {
|
|
@@ -30557,17 +30591,17 @@ function generateTieMatchUps({
|
|
|
30557
30591
|
const matchUps = generateRange(0, matchUpCount || 0).map(index => {
|
|
30558
30592
|
const collectionPosition = index + 1;
|
|
30559
30593
|
const matchUp = {
|
|
30560
|
-
isMock,
|
|
30561
|
-
collectionId,
|
|
30562
|
-
matchUpType,
|
|
30563
|
-
matchUpFormat,
|
|
30564
|
-
collectionPosition,
|
|
30565
|
-
matchUpId: (uuids === null || uuids === void 0 ? void 0 : uuids.pop()) || UUID(),
|
|
30566
30594
|
sides: [{
|
|
30567
30595
|
sideNumber: 1
|
|
30568
30596
|
}, {
|
|
30569
30597
|
sideNumber: 2
|
|
30570
|
-
}]
|
|
30598
|
+
}],
|
|
30599
|
+
matchUpId: (uuids === null || uuids === void 0 ? void 0 : uuids.pop()) || UUID(),
|
|
30600
|
+
collectionPosition,
|
|
30601
|
+
matchUpFormat,
|
|
30602
|
+
collectionId,
|
|
30603
|
+
matchUpType,
|
|
30604
|
+
isMock
|
|
30571
30605
|
};
|
|
30572
30606
|
return matchUp;
|
|
30573
30607
|
});
|
|
@@ -35518,12 +35552,12 @@ function alternateDrawPositionAssignment$1({
|
|
|
35518
35552
|
structureId
|
|
35519
35553
|
}) {
|
|
35520
35554
|
return positionParticipantAction({
|
|
35555
|
+
positionActionName: 'alternateDrawPositionAssignment',
|
|
35556
|
+
participantIdAttributeName: 'alternateParticipantid',
|
|
35521
35557
|
participantId: alternateParticipantId,
|
|
35522
35558
|
drawDefinition,
|
|
35523
35559
|
drawPosition,
|
|
35524
|
-
structureId
|
|
35525
|
-
participantIdAttributeName: 'alternateParticipantid',
|
|
35526
|
-
positionActionName: 'alternateDrawPositionAssignment'
|
|
35560
|
+
structureId
|
|
35527
35561
|
});
|
|
35528
35562
|
}
|
|
35529
35563
|
|
|
@@ -36337,7 +36371,7 @@ function addDrawEntries$1({
|
|
|
36337
36371
|
if (positionsAvailable < participantIds.length) return {
|
|
36338
36372
|
error: MORE_PARTICIPANTS_THAN_DRAW_POSITIONS
|
|
36339
36373
|
};
|
|
36340
|
-
const
|
|
36374
|
+
const participantIdsNotAdded = participantIds.reduce((notAdded, participantId) => {
|
|
36341
36375
|
const invalidLuckyLoser = entryStatus === LUCKY_LOSER && participantInEntries({
|
|
36342
36376
|
participantId,
|
|
36343
36377
|
drawDefinition,
|
|
@@ -36354,23 +36388,12 @@ function addDrawEntries$1({
|
|
|
36354
36388
|
});
|
|
36355
36389
|
|
|
36356
36390
|
if (invalidEntry || invalidLuckyLoser || invalidVoluntaryConsolation) {
|
|
36357
|
-
return
|
|
36358
|
-
participantId,
|
|
36359
|
-
error: EXISTING_PARTICIPANT
|
|
36360
|
-
});
|
|
36391
|
+
return notAdded.concat(participantId);
|
|
36361
36392
|
}
|
|
36362
36393
|
|
|
36363
|
-
return
|
|
36394
|
+
return notAdded;
|
|
36364
36395
|
}, []);
|
|
36365
|
-
|
|
36366
|
-
if (invalidParticipantIds.length) {
|
|
36367
|
-
return {
|
|
36368
|
-
error: INVALID_ENTRIES,
|
|
36369
|
-
invalidParticipantIds
|
|
36370
|
-
};
|
|
36371
|
-
}
|
|
36372
|
-
|
|
36373
|
-
participantIds.filter(Boolean).forEach(participantId => {
|
|
36396
|
+
participantIds.filter(participantId => participantId && !participantIdsNotAdded.includes(participantId)).forEach(participantId => {
|
|
36374
36397
|
const entry = Object.assign({
|
|
36375
36398
|
participantId
|
|
36376
36399
|
}, {
|
|
@@ -36389,7 +36412,11 @@ function addDrawEntries$1({
|
|
|
36389
36412
|
modifyDrawNotice({
|
|
36390
36413
|
drawDefinition
|
|
36391
36414
|
});
|
|
36392
|
-
return {
|
|
36415
|
+
return participantIdsNotAdded !== null && participantIdsNotAdded !== void 0 && participantIdsNotAdded.length ? {
|
|
36416
|
+
message: 'some participantIds could not be added',
|
|
36417
|
+
participantIdsNotAdded,
|
|
36418
|
+
...SUCCESS
|
|
36419
|
+
} : { ...SUCCESS
|
|
36393
36420
|
};
|
|
36394
36421
|
}
|
|
36395
36422
|
|