tods-competition-factory 0.165.0 → 0.167.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 +47 -34
- 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.
|
|
252
|
+
return '0.167.0';
|
|
253
253
|
}
|
|
254
254
|
|
|
255
255
|
function isPowerOf2(n) {
|
|
@@ -5367,7 +5367,7 @@ function getMatchUpFormatTiming({
|
|
|
5367
5367
|
error: MISSING_TOURNAMENT_RECORD
|
|
5368
5368
|
}; // event is optional, so eventType can also be passed in directly
|
|
5369
5369
|
|
|
5370
|
-
eventType = eventType || (event === null || event === void 0 ? void 0 : event.eventType);
|
|
5370
|
+
eventType = eventType || (event === null || event === void 0 ? void 0 : event.eventType) || SINGLES$1;
|
|
5371
5371
|
const defaultTiming = {
|
|
5372
5372
|
averageTimes: [{
|
|
5373
5373
|
minutes: {
|
|
@@ -18267,6 +18267,7 @@ function modifyMatchUpScore({
|
|
|
18267
18267
|
|
|
18268
18268
|
if (removeScore) {
|
|
18269
18269
|
Object.assign(matchUp, toBePlayed);
|
|
18270
|
+
delete matchUp.score;
|
|
18270
18271
|
} else if (score) {
|
|
18271
18272
|
matchUp.score = score;
|
|
18272
18273
|
}
|
|
@@ -18353,6 +18354,8 @@ function modifyMatchUpScore({
|
|
|
18353
18354
|
function updateTieMatchUpScore({
|
|
18354
18355
|
tournamentRecord,
|
|
18355
18356
|
drawDefinition,
|
|
18357
|
+
matchUpStatus,
|
|
18358
|
+
removeScore,
|
|
18356
18359
|
matchUpId,
|
|
18357
18360
|
structure,
|
|
18358
18361
|
event
|
|
@@ -18381,14 +18384,20 @@ function updateTieMatchUpScore({
|
|
|
18381
18384
|
};
|
|
18382
18385
|
matchUp.score = scoreObject;
|
|
18383
18386
|
const hasWinner = [1, 2].includes(winningSide);
|
|
18384
|
-
const
|
|
18387
|
+
const newMatchUpStatus = hasWinner ? COMPLETED : isActiveMatchUp({
|
|
18388
|
+
matchUpStatus: matchUpStatus || matchUp.matchUpStatus,
|
|
18389
|
+
tieMatchUps: matchUp.tieMatchUps,
|
|
18390
|
+
winningSide: matchUp.winningSide,
|
|
18391
|
+
score: scoreObject
|
|
18392
|
+
}) ? IN_PROGRESS : TO_BE_PLAYED;
|
|
18385
18393
|
const removeWinningSide = matchUp.winningSide && !hasWinner;
|
|
18386
18394
|
modifyMatchUpScore({
|
|
18387
|
-
|
|
18395
|
+
matchUpStatus: newMatchUpStatus,
|
|
18388
18396
|
score: scoreObject,
|
|
18389
18397
|
removeWinningSide,
|
|
18398
|
+
tournamentRecord,
|
|
18390
18399
|
drawDefinition,
|
|
18391
|
-
|
|
18400
|
+
removeScore,
|
|
18392
18401
|
winningSide,
|
|
18393
18402
|
matchUpId,
|
|
18394
18403
|
matchUp,
|
|
@@ -26714,11 +26723,11 @@ function modifyScheduling({
|
|
|
26714
26723
|
|
|
26715
26724
|
function modifyEventMatchUpFormatTiming$1({
|
|
26716
26725
|
tournamentRecord,
|
|
26717
|
-
|
|
26718
|
-
categoryType,
|
|
26719
|
-
matchUpFormat,
|
|
26726
|
+
recoveryMinutes,
|
|
26720
26727
|
averageMinutes,
|
|
26721
|
-
|
|
26728
|
+
matchUpFormat,
|
|
26729
|
+
categoryType,
|
|
26730
|
+
event
|
|
26722
26731
|
}) {
|
|
26723
26732
|
if (!tournamentRecord) return {
|
|
26724
26733
|
error: MISSING_TOURNAMENT_RECORD
|
|
@@ -26738,8 +26747,7 @@ function modifyEventMatchUpFormatTiming$1({
|
|
|
26738
26747
|
event
|
|
26739
26748
|
});
|
|
26740
26749
|
const category = event.category;
|
|
26741
|
-
const categoryName = (category === null || category === void 0 ? void 0 : category.categoryName) || (category === null || category === void 0 ? void 0 : category.ageCategoryCode);
|
|
26742
|
-
const isDoubles = event.eventType === 'DOUBLES';
|
|
26750
|
+
const categoryName = (category === null || category === void 0 ? void 0 : category.categoryName) || (category === null || category === void 0 ? void 0 : category.ageCategoryCode) || (event === null || event === void 0 ? void 0 : event.eventId);
|
|
26743
26751
|
let currentAverageTime = {
|
|
26744
26752
|
categoryNames: [categoryName],
|
|
26745
26753
|
minutes: {}
|
|
@@ -26786,14 +26794,14 @@ function modifyEventMatchUpFormatTiming$1({
|
|
|
26786
26794
|
|
|
26787
26795
|
if (validAverageMinutes) {
|
|
26788
26796
|
Object.assign(currentAverageTime.minutes, {
|
|
26789
|
-
[
|
|
26797
|
+
[(event === null || event === void 0 ? void 0 : event.eventType) || SINGLES$1]: averageMinutes
|
|
26790
26798
|
});
|
|
26791
26799
|
newAverageTimes.push(currentAverageTime);
|
|
26792
26800
|
}
|
|
26793
26801
|
|
|
26794
26802
|
if (validRecoveryMinutes) {
|
|
26795
26803
|
Object.assign(currentRecoveryTime.minutes, {
|
|
26796
|
-
[
|
|
26804
|
+
[(event === null || event === void 0 ? void 0 : event.eventType) || SINGLES$1]: recoveryMinutes
|
|
26797
26805
|
});
|
|
26798
26806
|
newRecoveryTimes.push(currentRecoveryTime);
|
|
26799
26807
|
}
|
|
@@ -27001,7 +27009,7 @@ function getEventMatchUpFormatTiming$1({
|
|
|
27001
27009
|
eventId,
|
|
27002
27010
|
category
|
|
27003
27011
|
} = event;
|
|
27004
|
-
const categoryName = category === null || category === void 0 ? void 0 : category.categoryName;
|
|
27012
|
+
const categoryName = (category === null || category === void 0 ? void 0 : category.categoryName) || (category === null || category === void 0 ? void 0 : category.ageCategoryCode) || eventId;
|
|
27005
27013
|
if (!eventId) return {
|
|
27006
27014
|
error: MISSING_EVENT
|
|
27007
27015
|
};
|
|
@@ -40843,6 +40851,8 @@ function resetScorecard$1(params) {
|
|
|
40843
40851
|
}
|
|
40844
40852
|
|
|
40845
40853
|
const result = updateTieMatchUpScore({
|
|
40854
|
+
matchUpStatus: TO_BE_PLAYED,
|
|
40855
|
+
removeScore: true,
|
|
40846
40856
|
tournamentRecord,
|
|
40847
40857
|
drawDefinition,
|
|
40848
40858
|
matchUpId,
|
|
@@ -44968,10 +44978,21 @@ function getDrawData({
|
|
|
44968
44978
|
|
|
44969
44979
|
let mainStageSeedAssignments, qualificationStageSeedAssignments;
|
|
44970
44980
|
const {
|
|
44971
|
-
structureGroups
|
|
44981
|
+
structureGroups,
|
|
44982
|
+
allStructuresLinked
|
|
44972
44983
|
} = getStructureGroups({
|
|
44973
44984
|
drawDefinition
|
|
44974
44985
|
});
|
|
44986
|
+
|
|
44987
|
+
if (!allStructuresLinked) {
|
|
44988
|
+
const error = {
|
|
44989
|
+
error: UNLINKED_STRUCTURES
|
|
44990
|
+
};
|
|
44991
|
+
return {
|
|
44992
|
+
error
|
|
44993
|
+
};
|
|
44994
|
+
}
|
|
44995
|
+
|
|
44975
44996
|
let drawActive = false;
|
|
44976
44997
|
let participantPlacements = false; // if any positionAssignments include a participantId
|
|
44977
44998
|
|
|
@@ -45094,16 +45115,6 @@ function getDrawData({
|
|
|
45094
45115
|
structures.forEach(structure => delete structure.positionAssignments);
|
|
45095
45116
|
return structures;
|
|
45096
45117
|
});
|
|
45097
|
-
|
|
45098
|
-
if (groupedStructures.length > 1) {
|
|
45099
|
-
const error = {
|
|
45100
|
-
error: UNLINKED_STRUCTURES
|
|
45101
|
-
};
|
|
45102
|
-
return {
|
|
45103
|
-
error
|
|
45104
|
-
};
|
|
45105
|
-
}
|
|
45106
|
-
|
|
45107
45118
|
const structures = groupedStructures.flat();
|
|
45108
45119
|
drawInfo.drawActive = drawActive;
|
|
45109
45120
|
drawInfo.participantPlacements = participantPlacements;
|
|
@@ -45141,24 +45152,25 @@ function getStructureGroups({
|
|
|
45141
45152
|
}); // at this point all linkedStructureIds arrays should be equivalent
|
|
45142
45153
|
// use the first of these as the identity array
|
|
45143
45154
|
|
|
45144
|
-
const
|
|
45155
|
+
const groupedStructureIds = linkedStructureIds[0]; // utility method to recognize equivalent arrays of structureIds
|
|
45145
45156
|
|
|
45146
45157
|
const identityLink = (a, b) => intersection(a, b).length === a.length; // check that all arrays of linkedStructureIds are equivalent to identity array
|
|
45147
45158
|
|
|
45148
45159
|
|
|
45149
45160
|
const allLinkStructuresLinked = linkedStructureIds.slice(1).reduce((allLinkStructuresLinked, ids) => {
|
|
45150
|
-
return allLinkStructuresLinked && identityLink(ids,
|
|
45151
|
-
}, true); // if a drawDefinition contains no links
|
|
45161
|
+
return allLinkStructuresLinked && identityLink(ids, groupedStructureIds);
|
|
45162
|
+
}, true); // if a drawDefinition contains no links then no structure groups will exist
|
|
45152
45163
|
// filter out undefined when there are no links in a drawDefinition
|
|
45153
45164
|
|
|
45154
|
-
const structureGroups = [
|
|
45165
|
+
const structureGroups = [groupedStructureIds].filter(Boolean); // this is the same as structureGroups, but excludes VOLUNTARY_CONSOLATION
|
|
45166
|
+
|
|
45167
|
+
const linkCheck = [groupedStructureIds].filter(Boolean); // iterate through all structures to add missing structureIds
|
|
45155
45168
|
|
|
45156
45169
|
const structures = drawDefinition.structures || [];
|
|
45157
|
-
structures.
|
|
45158
|
-
stage
|
|
45159
|
-
}) => stage !== VOLUNTARY_CONSOLATION).forEach(structure => {
|
|
45170
|
+
structures.forEach(structure => {
|
|
45160
45171
|
const {
|
|
45161
|
-
structureId
|
|
45172
|
+
structureId,
|
|
45173
|
+
stage
|
|
45162
45174
|
} = structure;
|
|
45163
45175
|
const existingGroup = structureGroups.find(group => {
|
|
45164
45176
|
return group.includes(structureId);
|
|
@@ -45166,9 +45178,10 @@ function getStructureGroups({
|
|
|
45166
45178
|
|
|
45167
45179
|
if (!existingGroup) {
|
|
45168
45180
|
structureGroups.push([structureId]);
|
|
45181
|
+
if (stage !== VOLUNTARY_CONSOLATION) linkCheck.push(structureId);
|
|
45169
45182
|
}
|
|
45170
45183
|
});
|
|
45171
|
-
const allStructuresLinked = allLinkStructuresLinked &&
|
|
45184
|
+
const allStructuresLinked = allLinkStructuresLinked && linkCheck.length === 1;
|
|
45172
45185
|
return {
|
|
45173
45186
|
structureGroups,
|
|
45174
45187
|
allStructuresLinked
|