tods-competition-factory 0.86.2 → 0.86.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 +108 -59
- 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 +13 -13
|
@@ -249,7 +249,7 @@ const matchUpFormatCode = {
|
|
|
249
249
|
};
|
|
250
250
|
|
|
251
251
|
function factoryVersion() {
|
|
252
|
-
return '0.86.
|
|
252
|
+
return '0.86.3';
|
|
253
253
|
}
|
|
254
254
|
|
|
255
255
|
const FORMAT_STANDARD = 'SET3-S:6/TB7'; // Best of 3 Tiebreak Sets to 6
|
|
@@ -10040,11 +10040,15 @@ function getMappedStructureMatchUps({
|
|
|
10040
10040
|
} = mappedMatchUps[itemStructureId];
|
|
10041
10041
|
|
|
10042
10042
|
if (inContext) {
|
|
10043
|
-
|
|
10044
|
-
|
|
10045
|
-
|
|
10046
|
-
|
|
10047
|
-
|
|
10043
|
+
const inContextMatchUps = matchUps.map(matchUp => {
|
|
10044
|
+
const inContextMatchUp = Object.assign(makeDeepCopy(matchUp, true, true), {
|
|
10045
|
+
containerStructureId: structureId,
|
|
10046
|
+
structureId: itemStructureId,
|
|
10047
|
+
structureName
|
|
10048
|
+
});
|
|
10049
|
+
return inContextMatchUp;
|
|
10050
|
+
});
|
|
10051
|
+
return inContextMatchUps;
|
|
10048
10052
|
} else {
|
|
10049
10053
|
return matchUps;
|
|
10050
10054
|
}
|
|
@@ -11119,22 +11123,28 @@ function getOrderedDrawPositions({
|
|
|
11119
11123
|
}
|
|
11120
11124
|
|
|
11121
11125
|
function isLucky({
|
|
11126
|
+
hasOddMatchUpsCount,
|
|
11122
11127
|
drawDefinition,
|
|
11128
|
+
roundMatchUps,
|
|
11123
11129
|
structure
|
|
11124
11130
|
}) {
|
|
11125
|
-
var _roundMatchUps$,
|
|
11131
|
+
var _roundMatchUps, _roundMatchUps$, _roundMatchUps2, _roundMatchUps2$;
|
|
11126
11132
|
|
|
11127
11133
|
if (!structure) return false;
|
|
11128
|
-
|
|
11129
|
-
|
|
11130
|
-
|
|
11131
|
-
|
|
11132
|
-
|
|
11133
|
-
|
|
11134
|
-
|
|
11134
|
+
|
|
11135
|
+
if (!roundMatchUps) {
|
|
11136
|
+
({
|
|
11137
|
+
hasOddMatchUpsCount,
|
|
11138
|
+
roundMatchUps
|
|
11139
|
+
} = getRoundMatchUps$1({
|
|
11140
|
+
matchUps: structure.matchUps || []
|
|
11141
|
+
}));
|
|
11142
|
+
}
|
|
11143
|
+
|
|
11144
|
+
const hasFirstRoundDrawPositions = !!((_roundMatchUps = roundMatchUps) !== null && _roundMatchUps !== void 0 && (_roundMatchUps$ = _roundMatchUps[1]) !== null && _roundMatchUps$ !== void 0 && _roundMatchUps$.find(({
|
|
11135
11145
|
drawPositions
|
|
11136
11146
|
}) => drawPositions));
|
|
11137
|
-
const noSecondRoundDrawPositions = !(roundMatchUps !== null &&
|
|
11147
|
+
const noSecondRoundDrawPositions = !((_roundMatchUps2 = roundMatchUps) !== null && _roundMatchUps2 !== void 0 && (_roundMatchUps2$ = _roundMatchUps2[2]) !== null && _roundMatchUps2$ !== void 0 && _roundMatchUps2$.find(({
|
|
11138
11148
|
drawPositions
|
|
11139
11149
|
}) => drawPositions));
|
|
11140
11150
|
return hasOddMatchUpsCount && !(structure !== null && structure !== void 0 && structure.structures) && hasFirstRoundDrawPositions && noSecondRoundDrawPositions && !(drawDefinition !== null && drawDefinition !== void 0 && drawDefinition.drawType && drawDefinition.drawType !== LUCKY_DRAW);
|
|
@@ -11155,16 +11165,10 @@ function getRoundContextProfile({
|
|
|
11155
11165
|
structure,
|
|
11156
11166
|
matchUps
|
|
11157
11167
|
}) {
|
|
11158
|
-
const roundNamingProfile = {};
|
|
11159
|
-
const isRoundRobin = structure.structures;
|
|
11160
|
-
const isAdHocStructure = isAdHoc({
|
|
11161
|
-
structure
|
|
11162
|
-
});
|
|
11163
|
-
const isLuckyStructure = isLucky({
|
|
11164
|
-
structure
|
|
11165
|
-
});
|
|
11166
11168
|
const {
|
|
11167
|
-
|
|
11169
|
+
hasOddMatchUpsCount,
|
|
11170
|
+
roundProfile,
|
|
11171
|
+
roundMatchUps
|
|
11168
11172
|
} = getRoundMatchUps$1({
|
|
11169
11173
|
matchUps
|
|
11170
11174
|
});
|
|
@@ -11172,6 +11176,16 @@ function getRoundContextProfile({
|
|
|
11172
11176
|
structureAbbreviation,
|
|
11173
11177
|
stage
|
|
11174
11178
|
} = structure;
|
|
11179
|
+
const isAdHocStructure = isAdHoc({
|
|
11180
|
+
structure
|
|
11181
|
+
});
|
|
11182
|
+
const isLuckyStructure = isLucky({
|
|
11183
|
+
hasOddMatchUpsCount,
|
|
11184
|
+
roundMatchUps,
|
|
11185
|
+
structure
|
|
11186
|
+
});
|
|
11187
|
+
const isRoundRobin = structure.structures;
|
|
11188
|
+
const roundNamingProfile = {};
|
|
11175
11189
|
const defaultRoundNamingPolicy = POLICY_ROUND_NAMING_DEFAULT[POLICY_TYPE_ROUND_NAMING];
|
|
11176
11190
|
const roundNamingMap = (roundNamingPolicy === null || roundNamingPolicy === void 0 ? void 0 : roundNamingPolicy.roundNamingMap) || defaultRoundNamingPolicy.roundNamingMap || {};
|
|
11177
11191
|
const abbreviatedRoundNamingMap = (roundNamingPolicy === null || roundNamingPolicy === void 0 ? void 0 : roundNamingPolicy.abbreviatedRoundNamingMap) || defaultRoundNamingPolicy.abbreviatedRoundNamingMap || {};
|
|
@@ -11216,12 +11230,14 @@ function getRoundContextProfile({
|
|
|
11216
11230
|
|
|
11217
11231
|
return {
|
|
11218
11232
|
roundNamingProfile,
|
|
11219
|
-
roundProfile
|
|
11233
|
+
roundProfile,
|
|
11234
|
+
roundMatchUps
|
|
11220
11235
|
};
|
|
11221
11236
|
}
|
|
11222
11237
|
|
|
11223
11238
|
function getDrawPositionsRanges({
|
|
11224
11239
|
drawDefinition,
|
|
11240
|
+
roundProfile,
|
|
11225
11241
|
structureId,
|
|
11226
11242
|
matchUpsMap
|
|
11227
11243
|
}) {
|
|
@@ -11233,15 +11249,19 @@ function getDrawPositionsRanges({
|
|
|
11233
11249
|
if (!structureId) return {
|
|
11234
11250
|
error: MISSING_STRUCTURE_ID
|
|
11235
11251
|
};
|
|
11236
|
-
|
|
11237
|
-
|
|
11238
|
-
|
|
11239
|
-
|
|
11240
|
-
|
|
11241
|
-
|
|
11242
|
-
|
|
11243
|
-
|
|
11244
|
-
|
|
11252
|
+
|
|
11253
|
+
if (!roundProfile) {
|
|
11254
|
+
const structureMatchUps = getMappedStructureMatchUps({
|
|
11255
|
+
matchUpsMap,
|
|
11256
|
+
structureId
|
|
11257
|
+
});
|
|
11258
|
+
({
|
|
11259
|
+
roundProfile
|
|
11260
|
+
} = getRoundMatchUps$1({
|
|
11261
|
+
matchUps: structureMatchUps
|
|
11262
|
+
}));
|
|
11263
|
+
}
|
|
11264
|
+
|
|
11245
11265
|
const firstRoundFirstDrawPosition = Math.min(...(((_roundProfile$ = roundProfile[1]) === null || _roundProfile$ === void 0 ? void 0 : _roundProfile$.drawPositions) || []));
|
|
11246
11266
|
const firstRoundFirstDrawPositionOffset = (firstRoundFirstDrawPosition || 1) - 1;
|
|
11247
11267
|
const roundNumbers = Object.keys(roundProfile);
|
|
@@ -11695,9 +11715,9 @@ function getAllStructureMatchUps({
|
|
|
11695
11715
|
|
|
11696
11716
|
if (!targetEvent || !targetStructure || !targetDraw) {
|
|
11697
11717
|
return {
|
|
11698
|
-
matchUps: [],
|
|
11699
11718
|
collectionPositionMatchUps,
|
|
11700
|
-
roundMatchUps
|
|
11719
|
+
roundMatchUps,
|
|
11720
|
+
matchUps: []
|
|
11701
11721
|
};
|
|
11702
11722
|
} // TODO: code is shared with matchUpActions.js
|
|
11703
11723
|
// TODO: extend testing to restrict for MAIN while leaving consolation unrestricted
|
|
@@ -11755,15 +11775,17 @@ function getAllStructureMatchUps({
|
|
|
11755
11775
|
inContext
|
|
11756
11776
|
});
|
|
11757
11777
|
const roundNamingPolicy = appliedPolicies && appliedPolicies[POLICY_TYPE_ROUND_NAMING];
|
|
11758
|
-
const {
|
|
11759
|
-
roundNamingProfile,
|
|
11760
|
-
roundProfile
|
|
11761
|
-
} = getRoundContextProfile({
|
|
11778
|
+
const result = getRoundContextProfile({
|
|
11762
11779
|
roundNamingPolicy,
|
|
11763
11780
|
drawDefinition,
|
|
11764
11781
|
structure,
|
|
11765
11782
|
matchUps
|
|
11766
11783
|
});
|
|
11784
|
+
const {
|
|
11785
|
+
roundNamingProfile,
|
|
11786
|
+
roundProfile
|
|
11787
|
+
} = result;
|
|
11788
|
+
roundMatchUps = result.roundMatchUps;
|
|
11767
11789
|
|
|
11768
11790
|
if (matchUpFilters) {
|
|
11769
11791
|
matchUps = filterMatchUps({
|
|
@@ -11788,6 +11810,7 @@ function getAllStructureMatchUps({
|
|
|
11788
11810
|
drawPositionsRanges
|
|
11789
11811
|
} = getDrawPositionsRanges({
|
|
11790
11812
|
drawDefinition,
|
|
11813
|
+
roundProfile,
|
|
11791
11814
|
matchUpsMap,
|
|
11792
11815
|
structureId
|
|
11793
11816
|
});
|
|
@@ -11834,16 +11857,22 @@ function getAllStructureMatchUps({
|
|
|
11834
11857
|
});
|
|
11835
11858
|
}
|
|
11836
11859
|
|
|
11837
|
-
({
|
|
11838
|
-
|
|
11839
|
-
|
|
11840
|
-
|
|
11841
|
-
|
|
11842
|
-
|
|
11843
|
-
|
|
11844
|
-
|
|
11845
|
-
|
|
11846
|
-
|
|
11860
|
+
if (matchUpFilters !== null && matchUpFilters !== void 0 && matchUpFilters.matchUpTypes || matchUpFilters !== null && matchUpFilters !== void 0 && matchUpFilters.matchUpIds || inContext) {
|
|
11861
|
+
({
|
|
11862
|
+
roundMatchUps
|
|
11863
|
+
} = getRoundMatchUps$1({
|
|
11864
|
+
matchUps
|
|
11865
|
+
}));
|
|
11866
|
+
}
|
|
11867
|
+
|
|
11868
|
+
if (structure.tieFormat || drawDefinition !== null && drawDefinition !== void 0 && drawDefinition.tieFormat || event !== null && event !== void 0 && event.tieFormat) {
|
|
11869
|
+
({
|
|
11870
|
+
collectionPositionMatchUps
|
|
11871
|
+
} = getCollectionPositionMatchUps({
|
|
11872
|
+
matchUps
|
|
11873
|
+
}));
|
|
11874
|
+
}
|
|
11875
|
+
|
|
11847
11876
|
if (roundFilter) matchUps = (_matchUps3 = matchUps) === null || _matchUps3 === void 0 ? void 0 : _matchUps3.filter(matchUp => matchUp.roundNumber === roundFilter);
|
|
11848
11877
|
return {
|
|
11849
11878
|
matchUps,
|
|
@@ -42708,6 +42737,7 @@ function analyzeDraws({
|
|
|
42708
42737
|
drawDefinitions.forEach(drawDefinition => {
|
|
42709
42738
|
let positionsAssignedCount = 0;
|
|
42710
42739
|
let matchUpsWithWinningSideCount = 0;
|
|
42740
|
+
let matchUpsNoOutcomeCount = 0;
|
|
42711
42741
|
const structures = (drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.structures) || [];
|
|
42712
42742
|
const structuresData = structures.map(structure => {
|
|
42713
42743
|
const {
|
|
@@ -42727,6 +42757,7 @@ function analyzeDraws({
|
|
|
42727
42757
|
}) => winningSide);
|
|
42728
42758
|
const winningSideCount = matchUpsWithWinningSide.filter(Boolean).length || 0;
|
|
42729
42759
|
matchUpsWithWinningSideCount += winningSideCount;
|
|
42760
|
+
matchUpsNoOutcomeCount += inContextStructureMatchUps.length - matchUpsWithWinningSideCount;
|
|
42730
42761
|
const maxWinningSideFirstRoundPosition = Math.max(matchUpsWithWinningSide.filter(({
|
|
42731
42762
|
roundNumber
|
|
42732
42763
|
}) => roundNumber === 1).map(({
|
|
@@ -42792,6 +42823,7 @@ function analyzeDraws({
|
|
|
42792
42823
|
if (canBePruned) drawsAnalysis.canBePruned.push(drawId);
|
|
42793
42824
|
const drawAnalysis = {
|
|
42794
42825
|
matchUpsWithWinningSideCount,
|
|
42826
|
+
matchUpsNoOutcomeCount,
|
|
42795
42827
|
positionsAssignedCount,
|
|
42796
42828
|
structuresData,
|
|
42797
42829
|
inactiveDraw,
|
|
@@ -46718,6 +46750,8 @@ function resetDrawDefinition({
|
|
|
46718
46750
|
}
|
|
46719
46751
|
|
|
46720
46752
|
function pruneDrawDefinition({
|
|
46753
|
+
matchPlayDrawPositions = true,
|
|
46754
|
+
// when simply extracting matchUps for aggregation, drawPositions are unnecessary
|
|
46721
46755
|
tournamentRecord,
|
|
46722
46756
|
drawDefinition,
|
|
46723
46757
|
drawId
|
|
@@ -46728,6 +46762,7 @@ function pruneDrawDefinition({
|
|
|
46728
46762
|
if (!drawDefinition) return {
|
|
46729
46763
|
error: MISSING_DRAW_DEFINITION
|
|
46730
46764
|
};
|
|
46765
|
+
let relevantMatchUps = [];
|
|
46731
46766
|
const {
|
|
46732
46767
|
drawsAnalysis
|
|
46733
46768
|
} = analyzeDraws({
|
|
@@ -46740,15 +46775,15 @@ function pruneDrawDefinition({
|
|
|
46740
46775
|
const {
|
|
46741
46776
|
structures: [mainStructure]
|
|
46742
46777
|
} = getDrawStructures({
|
|
46778
|
+
stageSequence: 1,
|
|
46743
46779
|
drawDefinition,
|
|
46744
|
-
stage: MAIN
|
|
46745
|
-
stageSequence: 1
|
|
46780
|
+
stage: MAIN
|
|
46746
46781
|
});
|
|
46747
46782
|
const structureData = drawAnalysis.structuresData.find(({
|
|
46748
46783
|
structureId
|
|
46749
46784
|
}) => mainStructure.structureId === structureId);
|
|
46750
46785
|
const matchUps = mainStructure.matchUps || [];
|
|
46751
|
-
|
|
46786
|
+
relevantMatchUps = matchUps.sort((a, b) => a.roundPosition - b.roundPosition).filter(({
|
|
46752
46787
|
roundNumber
|
|
46753
46788
|
}) => !structureData.inactiveRounds.includes(roundNumber));
|
|
46754
46789
|
const relevantMatchUpIds = relevantMatchUps.map(getMatchUpId);
|
|
@@ -46770,13 +46805,26 @@ function pruneDrawDefinition({
|
|
|
46770
46805
|
const drawPositionsMap = Object.assign({}, ...existingDrawPositions.map((drawPosition, i) => ({
|
|
46771
46806
|
[drawPosition]: i + 1
|
|
46772
46807
|
})));
|
|
46773
|
-
matchPlayMatchUps.forEach(matchUp =>
|
|
46774
|
-
|
|
46775
|
-
|
|
46776
|
-
|
|
46808
|
+
matchPlayMatchUps.forEach(matchUp => {
|
|
46809
|
+
if (matchPlayDrawPositions) {
|
|
46810
|
+
matchUp.drawPositions = matchUp.drawPositions.map(drawPosition => drawPositionsMap[drawPosition]);
|
|
46811
|
+
} else {
|
|
46812
|
+
delete matchUp.drawPositions;
|
|
46813
|
+
}
|
|
46777
46814
|
});
|
|
46778
|
-
|
|
46815
|
+
|
|
46816
|
+
if (matchPlayDrawPositions) {
|
|
46817
|
+
const updatedPositionAssignments = mainStructure.positionAssignments.filter(assignment => existingDrawPositions.includes(assignment.drawPosition)).map(assignment => {
|
|
46818
|
+
assignment.drawPosition = drawPositionsMap[assignment.drawPosition];
|
|
46819
|
+
return assignment;
|
|
46820
|
+
});
|
|
46821
|
+
mainStructure.positionAssignments = updatedPositionAssignments;
|
|
46822
|
+
} else {
|
|
46823
|
+
mainStructure.positionAssignments = [];
|
|
46824
|
+
}
|
|
46825
|
+
|
|
46779
46826
|
mainStructure.matchUps = matchPlayMatchUps;
|
|
46827
|
+
relevantMatchUps = matchPlayMatchUps;
|
|
46780
46828
|
}
|
|
46781
46829
|
|
|
46782
46830
|
deleteMatchUpsNotice({
|
|
@@ -46788,7 +46836,8 @@ function pruneDrawDefinition({
|
|
|
46788
46836
|
});
|
|
46789
46837
|
}
|
|
46790
46838
|
|
|
46791
|
-
return { ...SUCCESS
|
|
46839
|
+
return { ...SUCCESS,
|
|
46840
|
+
matchUps: relevantMatchUps
|
|
46792
46841
|
};
|
|
46793
46842
|
}
|
|
46794
46843
|
|