tods-competition-factory 0.98.2 → 0.99.0
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 +125 -39
- 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 +1 -1
|
@@ -249,7 +249,7 @@ const matchUpFormatCode = {
|
|
|
249
249
|
};
|
|
250
250
|
|
|
251
251
|
function factoryVersion() {
|
|
252
|
-
return '0.
|
|
252
|
+
return '0.99.0';
|
|
253
253
|
}
|
|
254
254
|
|
|
255
255
|
const FORMAT_STANDARD = 'SET3-S:6/TB7'; // Best of 3 Tiebreak Sets to 6
|
|
@@ -22414,7 +22414,7 @@ function addDrawDefinition$1({
|
|
|
22414
22414
|
drawDefinition,
|
|
22415
22415
|
event
|
|
22416
22416
|
}) {
|
|
22417
|
-
var _flightProfile$flight, _flightProfile$flight2, _flightProfile$flight3, _event$drawDefinition, _flightProfile$flight4;
|
|
22417
|
+
var _flightProfile$flight, _flightProfile$links, _flightProfile$links$, _flightProfile$links$2, _flightProfile$flight2, _flightProfile$flight3, _event$drawDefinition, _flightProfile$flight4;
|
|
22418
22418
|
|
|
22419
22419
|
if (!drawDefinition) return {
|
|
22420
22420
|
error: MISSING_DRAW_ID
|
|
@@ -22445,33 +22445,53 @@ function addDrawDefinition$1({
|
|
|
22445
22445
|
} = getFlightProfile({
|
|
22446
22446
|
event
|
|
22447
22447
|
});
|
|
22448
|
-
const relevantFlight = flightDefinition && (flightProfile === null || flightProfile === void 0 ? void 0 : (_flightProfile$flight = flightProfile.flights) === null || _flightProfile$flight === void 0 ? void 0 : _flightProfile$flight.find(flight => flight.flightNumber === flightDefinition.flightNumber));
|
|
22448
|
+
const relevantFlight = flightDefinition && (flightProfile === null || flightProfile === void 0 ? void 0 : (_flightProfile$flight = flightProfile.flights) === null || _flightProfile$flight === void 0 ? void 0 : _flightProfile$flight.find(flight => flight.flightNumber === flightDefinition.flightNumber)); // if there is a source drawId specified, the source draw must exist
|
|
22449
|
+
|
|
22450
|
+
const sourceDrawId = flightProfile === null || flightProfile === void 0 ? void 0 : (_flightProfile$links = flightProfile.links) === null || _flightProfile$links === void 0 ? void 0 : (_flightProfile$links$ = _flightProfile$links.find(link => {
|
|
22451
|
+
var _link$target;
|
|
22452
|
+
|
|
22453
|
+
return (link === null || link === void 0 ? void 0 : (_link$target = link.target) === null || _link$target === void 0 ? void 0 : _link$target.drawId) === drawId;
|
|
22454
|
+
})) === null || _flightProfile$links$ === void 0 ? void 0 : (_flightProfile$links$2 = _flightProfile$links$.source) === null || _flightProfile$links$2 === void 0 ? void 0 : _flightProfile$links$2.drawId;
|
|
22455
|
+
const sourceDrawIdError = sourceDrawId && !event.drawDefinitions.find(drawDefinition => drawDefinition.drawId === sourceDrawId);
|
|
22456
|
+
if (sourceDrawIdError) return {
|
|
22457
|
+
error: MISSING_DRAW_DEFINITION,
|
|
22458
|
+
sourceDrawId
|
|
22459
|
+
};
|
|
22449
22460
|
const flightConflict = relevantFlight && relevantFlight.drawId !== drawDefinition.drawId;
|
|
22450
|
-
|
|
22451
|
-
|
|
22452
|
-
|
|
22453
|
-
|
|
22461
|
+
|
|
22462
|
+
if (flightConflict) {
|
|
22463
|
+
return {
|
|
22464
|
+
error: INVALID_DRAW_DEFINITION,
|
|
22465
|
+
relevantFlight
|
|
22466
|
+
};
|
|
22467
|
+
} // check relevantFlight.drawEntries are equivalent to drawEntries
|
|
22468
|
+
|
|
22454
22469
|
|
|
22455
22470
|
const matchingFlighEntries = relevantFlight === null || relevantFlight === void 0 ? void 0 : relevantFlight.drawEntries.every(({
|
|
22456
22471
|
participantId,
|
|
22457
22472
|
entryStatus
|
|
22458
22473
|
}) => {
|
|
22459
22474
|
const drawEntry = drawEntries.find(drawEntry => drawEntry && drawEntry.participantId === participantId);
|
|
22460
|
-
return (drawEntry === null || drawEntry === void 0 ? void 0 : drawEntry.entryStatus) === entryStatus;
|
|
22475
|
+
return !entryStatus || (drawEntry === null || drawEntry === void 0 ? void 0 : drawEntry.entryStatus) === entryStatus;
|
|
22461
22476
|
}); // check that all drawEntries have equivalent entryStatus to event.entries
|
|
22462
22477
|
|
|
22463
22478
|
const matchingEventEntries = !checkEntryStatus || eventEntries && (drawEntries === null || drawEntries === void 0 ? void 0 : drawEntries.every(({
|
|
22464
22479
|
participantId,
|
|
22465
|
-
entryStatus
|
|
22480
|
+
entryStatus,
|
|
22481
|
+
entryStage
|
|
22466
22482
|
}) => {
|
|
22467
22483
|
const eventEntry = eventEntries.find(eventEntry => eventEntry.participantId === participantId);
|
|
22468
|
-
|
|
22484
|
+
const isVoluntaryConsolation = (relevantFlight === null || relevantFlight === void 0 ? void 0 : relevantFlight.stage) === VOLUNTARY_CONSOLATION && entryStage === VOLUNTARY_CONSOLATION;
|
|
22485
|
+
return isVoluntaryConsolation || (eventEntry === null || eventEntry === void 0 ? void 0 : eventEntry.entryStatus) === entryStatus;
|
|
22469
22486
|
}));
|
|
22470
|
-
|
|
22471
|
-
|
|
22472
|
-
|
|
22473
|
-
|
|
22474
|
-
|
|
22487
|
+
|
|
22488
|
+
if (relevantFlight && !matchingFlighEntries) {
|
|
22489
|
+
return {
|
|
22490
|
+
error: INVALID_DRAW_DEFINITION,
|
|
22491
|
+
relevantFlight,
|
|
22492
|
+
matchingEventEntries
|
|
22493
|
+
};
|
|
22494
|
+
}
|
|
22475
22495
|
|
|
22476
22496
|
if (modifyEventEntries) {
|
|
22477
22497
|
drawEntries.filter(Boolean).forEach(drawEntry => {
|
|
@@ -35578,6 +35598,7 @@ function generateDrawType(params = {}) {
|
|
|
35578
35598
|
// optional - specifies main structure FEED_IN for drawTypes CURTIS_CONSOLATION, FEED_IN_CHAMPIONSHIPS, FMLC
|
|
35579
35599
|
structureName,
|
|
35580
35600
|
goesTo = true,
|
|
35601
|
+
stage = MAIN,
|
|
35581
35602
|
isMock,
|
|
35582
35603
|
uuids
|
|
35583
35604
|
} = params;
|
|
@@ -35595,12 +35616,20 @@ function generateDrawType(params = {}) {
|
|
|
35595
35616
|
stage: MAIN
|
|
35596
35617
|
});
|
|
35597
35618
|
|
|
35598
|
-
if (
|
|
35619
|
+
if (stage === VOLUNTARY_CONSOLATION) {
|
|
35599
35620
|
setStageDrawSize({
|
|
35600
35621
|
drawSize: params.drawSize,
|
|
35601
35622
|
drawDefinition,
|
|
35602
|
-
stage
|
|
35623
|
+
stage
|
|
35603
35624
|
});
|
|
35625
|
+
} else {
|
|
35626
|
+
if (!mainStageDrawPositionsCount) {
|
|
35627
|
+
setStageDrawSize({
|
|
35628
|
+
drawSize: params.drawSize,
|
|
35629
|
+
drawDefinition,
|
|
35630
|
+
stage: MAIN
|
|
35631
|
+
});
|
|
35632
|
+
}
|
|
35604
35633
|
} // first generate any qualifying structures
|
|
35605
35634
|
|
|
35606
35635
|
|
|
@@ -35674,7 +35703,7 @@ function generateDrawType(params = {}) {
|
|
|
35674
35703
|
} = getDrawStructures({
|
|
35675
35704
|
drawDefinition,
|
|
35676
35705
|
stageSequence,
|
|
35677
|
-
stage
|
|
35706
|
+
stage
|
|
35678
35707
|
});
|
|
35679
35708
|
const structureCount = stageStructures.length;
|
|
35680
35709
|
if (structureCount >= sequenceLimit) return {
|
|
@@ -35689,7 +35718,7 @@ function generateDrawType(params = {}) {
|
|
|
35689
35718
|
stageSequence,
|
|
35690
35719
|
matchUps: [],
|
|
35691
35720
|
matchUpType,
|
|
35692
|
-
stage
|
|
35721
|
+
stage
|
|
35693
35722
|
});
|
|
35694
35723
|
drawDefinition.structures.push(structure);
|
|
35695
35724
|
return Object.assign({
|
|
@@ -35705,8 +35734,8 @@ function generateDrawType(params = {}) {
|
|
|
35705
35734
|
structureId: uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
|
|
35706
35735
|
stageSequence,
|
|
35707
35736
|
matchUpType,
|
|
35708
|
-
|
|
35709
|
-
|
|
35737
|
+
matchUps,
|
|
35738
|
+
stage
|
|
35710
35739
|
});
|
|
35711
35740
|
drawDefinition.structures.push(structure);
|
|
35712
35741
|
return Object.assign({
|
|
@@ -35722,8 +35751,8 @@ function generateDrawType(params = {}) {
|
|
|
35722
35751
|
structureId: uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
|
|
35723
35752
|
stageSequence,
|
|
35724
35753
|
matchUpType,
|
|
35725
|
-
|
|
35726
|
-
|
|
35754
|
+
matchUps,
|
|
35755
|
+
stage
|
|
35727
35756
|
});
|
|
35728
35757
|
drawDefinition.structures.push(structure);
|
|
35729
35758
|
return Object.assign({
|
|
@@ -37109,6 +37138,7 @@ function addDrawEntry({
|
|
|
37109
37138
|
stage: entryStage,
|
|
37110
37139
|
drawDefinition
|
|
37111
37140
|
})) {
|
|
37141
|
+
console.log(drawDefinition.extensions[0]);
|
|
37112
37142
|
return {
|
|
37113
37143
|
error: INVALID_STAGE
|
|
37114
37144
|
};
|
|
@@ -45895,8 +45925,10 @@ function deleteDrawDefinitions({
|
|
|
45895
45925
|
});
|
|
45896
45926
|
}
|
|
45897
45927
|
|
|
45898
|
-
|
|
45899
|
-
|
|
45928
|
+
drawIds.forEach(drawId => {
|
|
45929
|
+
deleteDrawNotice({
|
|
45930
|
+
drawId
|
|
45931
|
+
});
|
|
45900
45932
|
});
|
|
45901
45933
|
return SUCCESS;
|
|
45902
45934
|
}
|
|
@@ -47293,10 +47325,12 @@ function refreshEventDrawOrder({
|
|
|
47293
47325
|
|
|
47294
47326
|
function deleteFlightAndFlightDraw({
|
|
47295
47327
|
tournamentRecord,
|
|
47296
|
-
|
|
47328
|
+
auditData,
|
|
47297
47329
|
drawId,
|
|
47298
|
-
|
|
47330
|
+
event
|
|
47299
47331
|
}) {
|
|
47332
|
+
var _flightProfile$links, _flightProfile$links$, _flightProfile$links$2;
|
|
47333
|
+
|
|
47300
47334
|
if (!tournamentRecord) return {
|
|
47301
47335
|
error: MISSING_TOURNAMENT_RECORD
|
|
47302
47336
|
};
|
|
@@ -47311,20 +47345,42 @@ function deleteFlightAndFlightDraw({
|
|
|
47311
47345
|
} = getFlightProfile({
|
|
47312
47346
|
event
|
|
47313
47347
|
});
|
|
47348
|
+
const dependentDrawIds = (flightProfile === null || flightProfile === void 0 ? void 0 : (_flightProfile$links = flightProfile.links) === null || _flightProfile$links === void 0 ? void 0 : (_flightProfile$links$ = _flightProfile$links.filter(link => {
|
|
47349
|
+
var _link$source;
|
|
47350
|
+
|
|
47351
|
+
return ((_link$source = link.source) === null || _link$source === void 0 ? void 0 : _link$source.drawId) === drawId;
|
|
47352
|
+
})) === null || _flightProfile$links$ === void 0 ? void 0 : (_flightProfile$links$2 = _flightProfile$links$.map(link => {
|
|
47353
|
+
var _link$target;
|
|
47354
|
+
|
|
47355
|
+
return (_link$target = link.target) === null || _link$target === void 0 ? void 0 : _link$target.drawId;
|
|
47356
|
+
})) === null || _flightProfile$links$2 === void 0 ? void 0 : _flightProfile$links$2.filter(Boolean)) || [];
|
|
47314
47357
|
|
|
47315
47358
|
if (flightProfile) {
|
|
47316
47359
|
var _flightProfile$flight;
|
|
47317
47360
|
|
|
47318
47361
|
const flight = (_flightProfile$flight = flightProfile.flights) === null || _flightProfile$flight === void 0 ? void 0 : _flightProfile$flight.find(flight => flight.drawId === drawId);
|
|
47319
47362
|
|
|
47320
|
-
if (flight) {
|
|
47321
|
-
const flights = flightProfile.flights.filter(flight =>
|
|
47363
|
+
if (flight || dependentDrawIds.length) {
|
|
47364
|
+
const flights = flightProfile.flights.filter(flight => {
|
|
47365
|
+
const included = dependentDrawIds.includes(flight.drawId);
|
|
47366
|
+
return flight.drawId !== drawId && !included;
|
|
47367
|
+
});
|
|
47322
47368
|
const extension = {
|
|
47323
47369
|
name: FLIGHT_PROFILE,
|
|
47324
47370
|
value: { ...flightProfile,
|
|
47325
47371
|
flights
|
|
47326
47372
|
}
|
|
47327
|
-
};
|
|
47373
|
+
}; // TODO: this cleanup is not iterative
|
|
47374
|
+
|
|
47375
|
+
if (dependentDrawIds.length && flightProfile.links) {
|
|
47376
|
+
const links = flightProfile.links.filter(link => {
|
|
47377
|
+
var _link$target2;
|
|
47378
|
+
|
|
47379
|
+
return !dependentDrawIds.includes((_link$target2 = link.target) === null || _link$target2 === void 0 ? void 0 : _link$target2.drawId);
|
|
47380
|
+
});
|
|
47381
|
+
extension.value.links = links;
|
|
47382
|
+
}
|
|
47383
|
+
|
|
47328
47384
|
addEventExtension$1({
|
|
47329
47385
|
event,
|
|
47330
47386
|
extension
|
|
@@ -47335,7 +47391,7 @@ function deleteFlightAndFlightDraw({
|
|
|
47335
47391
|
deleteDrawDefinitions({
|
|
47336
47392
|
tournamentRecord,
|
|
47337
47393
|
eventId: event.eventId,
|
|
47338
|
-
drawIds: [drawId],
|
|
47394
|
+
drawIds: [drawId, ...dependentDrawIds],
|
|
47339
47395
|
auditData
|
|
47340
47396
|
});
|
|
47341
47397
|
return refreshEventDrawOrder({
|
|
@@ -47832,12 +47888,13 @@ function addFlight({
|
|
|
47832
47888
|
qualifyingPositions,
|
|
47833
47889
|
drawEntries = [],
|
|
47834
47890
|
matchUpValue,
|
|
47891
|
+
sourceDrawId,
|
|
47835
47892
|
drawName,
|
|
47836
47893
|
drawId,
|
|
47837
47894
|
event,
|
|
47838
47895
|
stage
|
|
47839
47896
|
}) {
|
|
47840
|
-
var _flightProfile$flight, _flightProfile$flight2;
|
|
47897
|
+
var _getFlightProfile, _flightProfile$flight, _flightProfile$flight2, _flightProfile$flight3;
|
|
47841
47898
|
|
|
47842
47899
|
if (!event) return {
|
|
47843
47900
|
error: MISSING_EVENT
|
|
@@ -47858,17 +47915,26 @@ function addFlight({
|
|
|
47858
47915
|
}
|
|
47859
47916
|
}
|
|
47860
47917
|
|
|
47861
|
-
const {
|
|
47862
|
-
flightProfile
|
|
47863
|
-
} = getFlightProfile({
|
|
47918
|
+
const flightProfile = (_getFlightProfile = getFlightProfile({
|
|
47864
47919
|
event
|
|
47865
|
-
});
|
|
47866
|
-
|
|
47920
|
+
})) === null || _getFlightProfile === void 0 ? void 0 : _getFlightProfile.flightProfile; // VOLUNTARY_CONSOLATION stage requires a link be established from source draw
|
|
47921
|
+
|
|
47922
|
+
if (stage === VOLUNTARY_CONSOLATION && !sourceDrawId) return {
|
|
47923
|
+
error: MISSING_VALUE
|
|
47924
|
+
}; // sourceDrawId must exist in flightProfile
|
|
47925
|
+
|
|
47926
|
+
if (sourceDrawId && !(flightProfile !== null && flightProfile !== void 0 && (_flightProfile$flight = flightProfile.flights) !== null && _flightProfile$flight !== void 0 && _flightProfile$flight.find(({
|
|
47927
|
+
drawId
|
|
47928
|
+
}) => drawId === sourceDrawId))) return {
|
|
47929
|
+
error: MISSING_DRAW_ID
|
|
47930
|
+
};
|
|
47931
|
+
const flightNumbers = (flightProfile === null || flightProfile === void 0 ? void 0 : (_flightProfile$flight2 = flightProfile.flights) === null || _flightProfile$flight2 === void 0 ? void 0 : (_flightProfile$flight3 = _flightProfile$flight2.map(({
|
|
47867
47932
|
flightNumber
|
|
47868
|
-
}) => !isNaN(flightNumber) && parseInt(flightNumber))) === null || _flightProfile$
|
|
47933
|
+
}) => !isNaN(flightNumber) && parseInt(flightNumber))) === null || _flightProfile$flight3 === void 0 ? void 0 : _flightProfile$flight3.filter(Boolean)) || [];
|
|
47869
47934
|
const flightNumber = Math.max(0, ...flightNumbers) + 1;
|
|
47935
|
+
const flightDrawId = drawId || UUID();
|
|
47870
47936
|
const flight = {
|
|
47871
|
-
drawId:
|
|
47937
|
+
drawId: flightDrawId,
|
|
47872
47938
|
flightNumber,
|
|
47873
47939
|
matchUpValue,
|
|
47874
47940
|
drawEntries,
|
|
@@ -47889,6 +47955,26 @@ function addFlight({
|
|
|
47889
47955
|
flights
|
|
47890
47956
|
}
|
|
47891
47957
|
};
|
|
47958
|
+
|
|
47959
|
+
if (sourceDrawId) {
|
|
47960
|
+
// if there is a sourceDrawId construct a link
|
|
47961
|
+
const links = (flightProfile === null || flightProfile === void 0 ? void 0 : flightProfile.links) || [];
|
|
47962
|
+
|
|
47963
|
+
if (stage === VOLUNTARY_CONSOLATION) {
|
|
47964
|
+
links.push({
|
|
47965
|
+
linkType: LOSER,
|
|
47966
|
+
source: {
|
|
47967
|
+
drawId: sourceDrawId
|
|
47968
|
+
},
|
|
47969
|
+
target: {
|
|
47970
|
+
drawId: flightDrawId
|
|
47971
|
+
}
|
|
47972
|
+
});
|
|
47973
|
+
}
|
|
47974
|
+
|
|
47975
|
+
extension.value.links = links;
|
|
47976
|
+
}
|
|
47977
|
+
|
|
47892
47978
|
return addEventExtension$1({
|
|
47893
47979
|
event,
|
|
47894
47980
|
extension
|