tods-competition-factory 0.82.0 → 0.83.3
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 +214 -187
- 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.3';
|
|
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
|
-
}
|
|
22604
|
+
});
|
|
22605
|
+
});
|
|
22628
22606
|
|
|
22629
|
-
|
|
22630
|
-
|
|
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
|
+
}
|
|
22631
22632
|
|
|
22632
|
-
participantIdMap[relevantParticipantId].draws[drawId]
|
|
22633
|
-
|
|
22634
|
-
|
|
22635
|
-
|
|
22636
|
-
|
|
22637
|
-
|
|
22638
|
-
|
|
22639
|
-
|
|
22640
|
-
|
|
22641
|
-
|
|
22642
|
-
|
|
22643
|
-
|
|
22644
|
-
|
|
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
|
+
}
|
|
22645
22649
|
|
|
22646
|
-
|
|
22647
|
-
|
|
22648
|
-
if (eventDrawIds && !(eventDrawIds !== null && eventDrawIds !== void 0 && eventDrawIds.includes(drawId))) {
|
|
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,
|
|
@@ -23021,10 +23027,15 @@ function annotateParticipant({
|
|
|
23021
23027
|
if (scaleItems !== null && scaleItems !== void 0 && scaleItems.length) {
|
|
23022
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();
|
|
23023
23029
|
|
|
23024
|
-
|
|
23030
|
+
const itemTypes = unique(scaleItems.map(({
|
|
23025
23031
|
itemType
|
|
23026
|
-
}) => itemType))
|
|
23027
|
-
|
|
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);
|
|
23028
23039
|
|
|
23029
23040
|
if (scaleItem) {
|
|
23030
23041
|
const [, type, format, scaleName] = scaleItem.itemType.split('.');
|
|
@@ -23431,7 +23442,7 @@ function getTournamentParticipants({
|
|
|
23431
23442
|
participantFilters,
|
|
23432
23443
|
participants: tournamentParticipants
|
|
23433
23444
|
});
|
|
23434
|
-
const addContext = withScheduleItems || scheduleAnalysis || withStatistics || withGroupings || withOpponents || withMatchUps || withEvents || withDraws || withISO
|
|
23445
|
+
const addContext = withScheduleItems || scheduleAnalysis || withStatistics || withGroupings || withOpponents || withMatchUps || withEvents || withDraws || withISO;
|
|
23435
23446
|
let participantIdsWithConflicts;
|
|
23436
23447
|
|
|
23437
23448
|
if (addContext) {
|
|
@@ -29376,14 +29387,27 @@ const competitionEngine = function () {
|
|
|
29376
29387
|
return engine;
|
|
29377
29388
|
}
|
|
29378
29389
|
|
|
29379
|
-
function
|
|
29390
|
+
function executeFunction(tournamentRecords, method, params, methodName) {
|
|
29380
29391
|
delete engine.success;
|
|
29381
29392
|
delete engine.error;
|
|
29393
|
+
const start = Date.now();
|
|
29394
|
+
const result = method({
|
|
29395
|
+
tournamentRecords,
|
|
29396
|
+
...params
|
|
29397
|
+
});
|
|
29398
|
+
const elapsed = Date.now() - start;
|
|
29399
|
+
const devContext = getDevContext();
|
|
29400
|
+
if (devContext.perf && (isNaN(devContext.perf) || elapsed > devContext.perf)) console.log('ce:', {
|
|
29401
|
+
methodName,
|
|
29402
|
+
elapsed
|
|
29403
|
+
});
|
|
29404
|
+
return result;
|
|
29405
|
+
}
|
|
29406
|
+
|
|
29407
|
+
function engineInvoke(method, params, methodName) {
|
|
29382
29408
|
const tournamentRecords = getTournamentRecords();
|
|
29383
29409
|
const snapshot = (params === null || params === void 0 ? void 0 : params.rollbackOnError) && makeDeepCopy(tournamentRecords, false, true);
|
|
29384
|
-
const result =
|
|
29385
|
-
tournamentRecords
|
|
29386
|
-
});
|
|
29410
|
+
const result = executeFunction(tournamentRecords, method, params, methodName);
|
|
29387
29411
|
if (result !== null && result !== void 0 && result.error && snapshot) setState$3(snapshot);
|
|
29388
29412
|
const notify = (result === null || result === void 0 ? void 0 : result.success) && (params === null || params === void 0 ? void 0 : params.delayNotify) !== true && (params === null || params === void 0 ? void 0 : params.doNotNotify) !== true;
|
|
29389
29413
|
if (notify) notifySubscribers();
|
|
@@ -29393,18 +29417,18 @@ const competitionEngine = function () {
|
|
|
29393
29417
|
|
|
29394
29418
|
function importGovernors(governors) {
|
|
29395
29419
|
governors.forEach(governor => {
|
|
29396
|
-
Object.keys(governor).forEach(
|
|
29397
|
-
engine[
|
|
29420
|
+
Object.keys(governor).forEach(methodName => {
|
|
29421
|
+
engine[methodName] = params => {
|
|
29398
29422
|
if (getDevContext()) {
|
|
29399
|
-
return engineInvoke(governor[
|
|
29423
|
+
return engineInvoke(governor[methodName], params, methodName);
|
|
29400
29424
|
} else {
|
|
29401
29425
|
try {
|
|
29402
|
-
return engineInvoke(governor[
|
|
29426
|
+
return engineInvoke(governor[methodName], params, methodName);
|
|
29403
29427
|
} catch (err) {
|
|
29404
29428
|
const error = err.toString();
|
|
29405
29429
|
console.log('ERROR', {
|
|
29406
29430
|
error,
|
|
29407
|
-
|
|
29431
|
+
methodName,
|
|
29408
29432
|
params: JSON.stringify(params)
|
|
29409
29433
|
});
|
|
29410
29434
|
console.log(err);
|
|
@@ -29428,15 +29452,13 @@ const competitionEngine = function () {
|
|
|
29428
29452
|
error: INVALID_VALUES
|
|
29429
29453
|
};
|
|
29430
29454
|
const {
|
|
29431
|
-
method,
|
|
29455
|
+
method: methodName,
|
|
29432
29456
|
params
|
|
29433
29457
|
} = directive;
|
|
29434
|
-
if (!engine[
|
|
29458
|
+
if (!engine[methodName]) return {
|
|
29435
29459
|
error: METHOD_NOT_FOUND
|
|
29436
29460
|
};
|
|
29437
|
-
const result = engine[
|
|
29438
|
-
tournamentRecords
|
|
29439
|
-
});
|
|
29461
|
+
const result = executeFunction(tournamentRecords, engine[methodName], params, methodName);
|
|
29440
29462
|
|
|
29441
29463
|
if (result !== null && result !== void 0 && result.error) {
|
|
29442
29464
|
if (snapshot) setState$3(snapshot);
|
|
@@ -36377,7 +36399,7 @@ function addDrawEntries$1({
|
|
|
36377
36399
|
});
|
|
36378
36400
|
|
|
36379
36401
|
if (invalidEntry || invalidLuckyLoser || invalidVoluntaryConsolation) {
|
|
36380
|
-
return notAdded.
|
|
36402
|
+
return notAdded.concat(participantId);
|
|
36381
36403
|
}
|
|
36382
36404
|
|
|
36383
36405
|
return notAdded;
|
|
@@ -36548,7 +36570,7 @@ function addEventEntries(params) {
|
|
|
36548
36570
|
return true;
|
|
36549
36571
|
}
|
|
36550
36572
|
|
|
36551
|
-
if (event.eventType === TEAM$1 && (participant.participantType === TEAM$1 || entryStatus
|
|
36573
|
+
if (event.eventType === TEAM$1 && (participant.participantType === TEAM$1 || isUngrouped(entryStatus) && participant.participantType === INDIVIDUAL$1)) {
|
|
36552
36574
|
return true;
|
|
36553
36575
|
}
|
|
36554
36576
|
|
|
@@ -47306,20 +47328,27 @@ const tournamentEngine = function () {
|
|
|
47306
47328
|
importGovernors([queryGovernor, eventGovernor, locationGovernor, policyGovernor, scheduleGovernor, publishingGovernor, tournamentGovernor, participantGovernor]);
|
|
47307
47329
|
return engine;
|
|
47308
47330
|
|
|
47309
|
-
function executeFunction(tournamentRecord, method, params) {
|
|
47331
|
+
function executeFunction(tournamentRecord, method, params, methodName) {
|
|
47310
47332
|
delete engine.success;
|
|
47311
47333
|
delete engine.error;
|
|
47334
|
+
const start = Date.now();
|
|
47312
47335
|
const augmentedParams = paramsMiddleWare(tournamentRecord, params);
|
|
47313
47336
|
const result = method({ ...augmentedParams,
|
|
47314
47337
|
tournamentRecord
|
|
47315
47338
|
});
|
|
47339
|
+
const elapsed = Date.now() - start;
|
|
47340
|
+
const devContext = getDevContext();
|
|
47341
|
+
if (devContext.perf && (isNaN(devContext.perf) || elapsed > devContext.perf)) console.log('te:', {
|
|
47342
|
+
methodName,
|
|
47343
|
+
elapsed
|
|
47344
|
+
});
|
|
47316
47345
|
return result;
|
|
47317
47346
|
}
|
|
47318
47347
|
|
|
47319
|
-
function engineInvoke(method, params) {
|
|
47348
|
+
function engineInvoke(method, params, methodName) {
|
|
47320
47349
|
const tournamentRecord = (params === null || params === void 0 ? void 0 : params.sandBoxRecord) || (params === null || params === void 0 ? void 0 : params.sandboxRecord) || (params === null || params === void 0 ? void 0 : params.sandboxTournament) || getTournamentRecord(getTournamentId());
|
|
47321
47350
|
const snapshot = (params === null || params === void 0 ? void 0 : params.rollbackOnError) && makeDeepCopy(tournamentRecord, false, true);
|
|
47322
|
-
const result = executeFunction(tournamentRecord, method, params);
|
|
47351
|
+
const result = executeFunction(tournamentRecord, method, params, methodName);
|
|
47323
47352
|
if (result !== null && result !== void 0 && result.error && snapshot) setState(snapshot);
|
|
47324
47353
|
const notify = (result === null || result === void 0 ? void 0 : result.success) && (params === null || params === void 0 ? void 0 : params.delayNotify) !== true && (params === null || params === void 0 ? void 0 : params.doNotNotify) !== true;
|
|
47325
47354
|
if (notify) notifySubscribers();
|
|
@@ -47329,18 +47358,18 @@ const tournamentEngine = function () {
|
|
|
47329
47358
|
|
|
47330
47359
|
function importGovernors(governors) {
|
|
47331
47360
|
governors.forEach(governor => {
|
|
47332
|
-
Object.keys(governor).forEach(
|
|
47333
|
-
engine[
|
|
47361
|
+
Object.keys(governor).forEach(methodName => {
|
|
47362
|
+
engine[methodName] = params => {
|
|
47334
47363
|
if (getDevContext()) {
|
|
47335
|
-
return engineInvoke(governor[
|
|
47364
|
+
return engineInvoke(governor[methodName], params, methodName);
|
|
47336
47365
|
} else {
|
|
47337
47366
|
try {
|
|
47338
|
-
return engineInvoke(governor[
|
|
47367
|
+
return engineInvoke(governor[methodName], params, methodName);
|
|
47339
47368
|
} catch (err) {
|
|
47340
47369
|
const error = err.toString();
|
|
47341
47370
|
console.log('ERROR', {
|
|
47342
47371
|
error,
|
|
47343
|
-
|
|
47372
|
+
methodName,
|
|
47344
47373
|
params: JSON.stringify(params)
|
|
47345
47374
|
});
|
|
47346
47375
|
console.log(err);
|
|
@@ -47365,13 +47394,13 @@ const tournamentEngine = function () {
|
|
|
47365
47394
|
error: INVALID_VALUES
|
|
47366
47395
|
};
|
|
47367
47396
|
const {
|
|
47368
|
-
method,
|
|
47397
|
+
method: methodName,
|
|
47369
47398
|
params
|
|
47370
47399
|
} = directive;
|
|
47371
|
-
if (!engine[
|
|
47400
|
+
if (!engine[methodName]) return {
|
|
47372
47401
|
error: METHOD_NOT_FOUND
|
|
47373
47402
|
};
|
|
47374
|
-
const result = executeFunction(tournamentRecord, engine[
|
|
47403
|
+
const result = executeFunction(tournamentRecord, engine[methodName], params, methodName);
|
|
47375
47404
|
|
|
47376
47405
|
if (result !== null && result !== void 0 && result.error) {
|
|
47377
47406
|
if (snapshot) setState(snapshot);
|
|
@@ -47462,7 +47491,7 @@ function tournamentEngineAsync(test) {
|
|
|
47462
47491
|
return result;
|
|
47463
47492
|
}
|
|
47464
47493
|
|
|
47465
|
-
async function engineInvoke(method, params) {
|
|
47494
|
+
async function engineInvoke(method, params, methodName) {
|
|
47466
47495
|
const tournamentRecord = (params === null || params === void 0 ? void 0 : params.sandBoxRecord) || (params === null || params === void 0 ? void 0 : params.sandboxRecord) || (params === null || params === void 0 ? void 0 : params.sandboxTournament) || getTournamentRecord(getTournamentId());
|
|
47467
47496
|
const snapshot = (params === null || params === void 0 ? void 0 : params.rollbackOnError) && makeDeepCopy(tournamentRecord, false, true);
|
|
47468
47497
|
const result = await executeFunctionAsync(tournamentRecord, method, params);
|
|
@@ -47477,15 +47506,13 @@ function tournamentEngineAsync(test) {
|
|
|
47477
47506
|
for (const governor of governors) {
|
|
47478
47507
|
const governorMethods = Object.keys(governor);
|
|
47479
47508
|
|
|
47480
|
-
for (const
|
|
47481
|
-
engine[
|
|
47509
|
+
for (const methodName of governorMethods) {
|
|
47510
|
+
engine[methodName] = async params => {
|
|
47482
47511
|
if (getDevContext()) {
|
|
47483
|
-
const result = await engineInvoke(governor[
|
|
47484
|
-
);
|
|
47512
|
+
const result = await engineInvoke(governor[methodName], params);
|
|
47485
47513
|
return result;
|
|
47486
47514
|
} else {
|
|
47487
|
-
const result = await engineInvoke(governor[
|
|
47488
|
-
);
|
|
47515
|
+
const result = await engineInvoke(governor[methodName], params);
|
|
47489
47516
|
return result;
|
|
47490
47517
|
}
|
|
47491
47518
|
};
|