tods-competition-factory 0.69.2 → 0.70.1
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 +213 -74
- 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 +8 -8
|
@@ -249,7 +249,7 @@ const matchUpFormatCode = {
|
|
|
249
249
|
};
|
|
250
250
|
|
|
251
251
|
function factoryVersion() {
|
|
252
|
-
return '0.
|
|
252
|
+
return '0.70.1';
|
|
253
253
|
}
|
|
254
254
|
|
|
255
255
|
const FORMAT_STANDARD = 'SET3-S:6/TB7'; // Best of 3 Tiebreak Sets to 6
|
|
@@ -5424,7 +5424,7 @@ function analyzeSet(params) {
|
|
|
5424
5424
|
const {
|
|
5425
5425
|
bestOf
|
|
5426
5426
|
} = matchUpScoringFormat || {};
|
|
5427
|
-
const isDecidingSet = !!(setNumber && setNumber === bestOf);
|
|
5427
|
+
const isDecidingSet = !!(setNumber && bestOf && setNumber === bestOf);
|
|
5428
5428
|
const setFormat = isDecidingSet && (matchUpScoringFormat === null || matchUpScoringFormat === void 0 ? void 0 : matchUpScoringFormat.finalSetFormat) || (matchUpScoringFormat === null || matchUpScoringFormat === void 0 ? void 0 : matchUpScoringFormat.setFormat);
|
|
5429
5429
|
const expectTiebreakSet = !!(setFormat !== null && setFormat !== void 0 && setFormat.tiebreakSet);
|
|
5430
5430
|
const expectTimedSet = !!(setFormat !== null && setFormat !== void 0 && setFormat.timed);
|
|
@@ -9540,7 +9540,11 @@ function getRoundMatchUps$1({
|
|
|
9540
9540
|
roundIndex += 1;
|
|
9541
9541
|
}
|
|
9542
9542
|
});
|
|
9543
|
+
const hasOddMatchUpsCount = !!Object.values(roundProfile).find(({
|
|
9544
|
+
matchUpsCount
|
|
9545
|
+
}) => !isPowerOf2(matchUpsCount));
|
|
9543
9546
|
return {
|
|
9547
|
+
hasOddMatchUpsCount,
|
|
9544
9548
|
maxMatchUpsCount,
|
|
9545
9549
|
roundMatchUps,
|
|
9546
9550
|
roundNumbers,
|
|
@@ -10698,7 +10702,7 @@ function isLucky({
|
|
|
10698
10702
|
|
|
10699
10703
|
if (!structure) return false;
|
|
10700
10704
|
const {
|
|
10701
|
-
|
|
10705
|
+
hasOddMatchUpsCount,
|
|
10702
10706
|
roundMatchUps
|
|
10703
10707
|
} = getRoundMatchUps$1({
|
|
10704
10708
|
matchUps: structure.matchUps || []
|
|
@@ -10709,9 +10713,6 @@ function isLucky({
|
|
|
10709
10713
|
const noSecondRoundDrawPositions = !(roundMatchUps !== null && roundMatchUps !== void 0 && (_roundMatchUps$2 = roundMatchUps[2]) !== null && _roundMatchUps$2 !== void 0 && _roundMatchUps$2.find(({
|
|
10710
10714
|
drawPositions
|
|
10711
10715
|
}) => drawPositions));
|
|
10712
|
-
const hasOddMatchUpsCount = Object.values(roundProfile).find(({
|
|
10713
|
-
matchUpsCount
|
|
10714
|
-
}) => !isPowerOf2(matchUpsCount));
|
|
10715
10716
|
return hasOddMatchUpsCount && !(structure !== null && structure !== void 0 && structure.structures) && hasFirstRoundDrawPositions && noSecondRoundDrawPositions && !(drawDefinition !== null && drawDefinition !== void 0 && drawDefinition.drawType && drawDefinition.drawType !== LUCKY_DRAW);
|
|
10716
10717
|
}
|
|
10717
10718
|
|
|
@@ -10939,7 +10940,7 @@ function getCheckedInParticipantIds({
|
|
|
10939
10940
|
return participantCheckedIn;
|
|
10940
10941
|
}); // if all individuals on one side are checked in then side is checked in
|
|
10941
10942
|
|
|
10942
|
-
nestedIndividualParticipantIds.forEach((sideIndividualParticipantIds, sideIndex) => {
|
|
10943
|
+
nestedIndividualParticipantIds === null || nestedIndividualParticipantIds === void 0 ? void 0 : nestedIndividualParticipantIds.forEach((sideIndividualParticipantIds, sideIndex) => {
|
|
10943
10944
|
const sideParticipantId = sideParticipantIds[sideIndex];
|
|
10944
10945
|
const allIndividualsCheckedIn = (sideIndividualParticipantIds === null || sideIndividualParticipantIds === void 0 ? void 0 : sideIndividualParticipantIds.length) && sideIndividualParticipantIds.reduce((checkedIn, participantId) => {
|
|
10945
10946
|
return checkedIn && participantId && checkedInParticipantIds.includes(participantId);
|
|
@@ -11447,9 +11448,7 @@ function getAllStructureMatchUps({
|
|
|
11447
11448
|
const collectionDefinitions = tieFormat === null || tieFormat === void 0 ? void 0 : tieFormat.collectionDefinitions;
|
|
11448
11449
|
const collectionDefinition = matchUp.collectionId && (collectionDefinitions === null || collectionDefinitions === void 0 ? void 0 : collectionDefinitions.find(definition => definition.collectionId === matchUp.collectionId));
|
|
11449
11450
|
const matchUpFormat = matchUp.matchUpFormat || matchUp.collectionId ? collectionDefinition && collectionDefinition.matchUpFormat : structure.matchUpFormat || (drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.matchUpFormat) || (event === null || event === void 0 ? void 0 : event.matchUpFormat);
|
|
11450
|
-
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);
|
|
11451
|
-
// console.log({ matchUpType, event });
|
|
11452
|
-
|
|
11451
|
+
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);
|
|
11453
11452
|
const matchUpStatus = isCollectionBye ? BYE : matchUp.matchUpStatus;
|
|
11454
11453
|
const {
|
|
11455
11454
|
schedule,
|
|
@@ -11491,8 +11490,8 @@ function getAllStructureMatchUps({
|
|
|
11491
11490
|
const onlyDefined = obj => definedAttributes(obj, undefined, true);
|
|
11492
11491
|
|
|
11493
11492
|
const matchUpWithContext = Object.assign({}, onlyDefined(context), onlyDefined({
|
|
11494
|
-
matchUpFormat: matchUp.matchUpType
|
|
11495
|
-
tieFormat: matchUp.matchUpType
|
|
11493
|
+
matchUpFormat: matchUp.matchUpType === TEAM$2 ? undefined : matchUpFormat,
|
|
11494
|
+
tieFormat: matchUp.matchUpType !== TEAM$2 ? undefined : tieFormat,
|
|
11496
11495
|
endDate: matchUp.endDate || endDate,
|
|
11497
11496
|
abbreviatedRoundName,
|
|
11498
11497
|
drawPositionsRange,
|
|
@@ -11599,6 +11598,17 @@ function getAllStructureMatchUps({
|
|
|
11599
11598
|
matchUpType
|
|
11600
11599
|
});
|
|
11601
11600
|
}
|
|
11601
|
+
|
|
11602
|
+
if (drawDefinition !== null && drawDefinition !== void 0 && drawDefinition.entries) {
|
|
11603
|
+
matchUpWithContext.sides.filter(Boolean).forEach(side => {
|
|
11604
|
+
if (side.participantId) {
|
|
11605
|
+
const entry = drawDefinition.entries.find(entry => entry.participantId === side.participantId);
|
|
11606
|
+
if (entry !== null && entry !== void 0 && entry.entryStatus) Object.assign(side, {
|
|
11607
|
+
entryStatus: entry.entryStatus || ALTERNATE
|
|
11608
|
+
});
|
|
11609
|
+
}
|
|
11610
|
+
});
|
|
11611
|
+
}
|
|
11602
11612
|
}
|
|
11603
11613
|
|
|
11604
11614
|
if (matchUpWithContext.tieMatchUps) {
|
|
@@ -12048,10 +12058,10 @@ function addMatchUpScheduleItems$2({
|
|
|
12048
12058
|
|
|
12049
12059
|
if (scheduledDate !== undefined) {
|
|
12050
12060
|
const result = addMatchUpScheduledDate$2({
|
|
12061
|
+
disableNotice: true,
|
|
12051
12062
|
drawDefinition,
|
|
12052
|
-
matchUpId,
|
|
12053
12063
|
scheduledDate,
|
|
12054
|
-
|
|
12064
|
+
matchUpId
|
|
12055
12065
|
});
|
|
12056
12066
|
if (result !== null && result !== void 0 && result.error) return {
|
|
12057
12067
|
error: result.error,
|
|
@@ -12061,10 +12071,10 @@ function addMatchUpScheduleItems$2({
|
|
|
12061
12071
|
|
|
12062
12072
|
if (scheduledTime !== undefined) {
|
|
12063
12073
|
const result = addMatchUpScheduledTime$2({
|
|
12074
|
+
disableNotice: true,
|
|
12064
12075
|
drawDefinition,
|
|
12065
|
-
matchUpId,
|
|
12066
12076
|
scheduledTime,
|
|
12067
|
-
|
|
12077
|
+
matchUpId
|
|
12068
12078
|
});
|
|
12069
12079
|
if (result !== null && result !== void 0 && result.error) return {
|
|
12070
12080
|
error: result.error,
|
|
@@ -12179,9 +12189,9 @@ function addMatchUpScheduleItems$2({
|
|
|
12179
12189
|
}
|
|
12180
12190
|
function addMatchUpScheduledDate$2({
|
|
12181
12191
|
drawDefinition,
|
|
12182
|
-
matchUpId,
|
|
12183
12192
|
disableNotice,
|
|
12184
|
-
scheduledDate
|
|
12193
|
+
scheduledDate,
|
|
12194
|
+
matchUpId
|
|
12185
12195
|
}) {
|
|
12186
12196
|
if (!matchUpId) return {
|
|
12187
12197
|
error: MISSING_MATCHUP_ID
|
|
@@ -12198,18 +12208,18 @@ function addMatchUpScheduledDate$2({
|
|
|
12198
12208
|
itemValue: scheduledDate
|
|
12199
12209
|
};
|
|
12200
12210
|
return addMatchUpTimeItem({
|
|
12211
|
+
duplicateValues: false,
|
|
12201
12212
|
drawDefinition,
|
|
12202
|
-
matchUpId,
|
|
12203
|
-
timeItem,
|
|
12204
12213
|
disableNotice,
|
|
12205
|
-
|
|
12214
|
+
matchUpId,
|
|
12215
|
+
timeItem
|
|
12206
12216
|
});
|
|
12207
12217
|
}
|
|
12208
12218
|
function addMatchUpScheduledTime$2({
|
|
12209
12219
|
drawDefinition,
|
|
12210
|
-
matchUpId,
|
|
12211
12220
|
disableNotice,
|
|
12212
|
-
scheduledTime
|
|
12221
|
+
scheduledTime,
|
|
12222
|
+
matchUpId
|
|
12213
12223
|
}) {
|
|
12214
12224
|
if (!matchUpId) return {
|
|
12215
12225
|
error: MISSING_MATCHUP_ID
|
|
@@ -12225,19 +12235,19 @@ function addMatchUpScheduledTime$2({
|
|
|
12225
12235
|
itemValue
|
|
12226
12236
|
};
|
|
12227
12237
|
return addMatchUpTimeItem({
|
|
12238
|
+
duplicateValues: false,
|
|
12228
12239
|
drawDefinition,
|
|
12229
|
-
matchUpId,
|
|
12230
|
-
timeItem,
|
|
12231
12240
|
disableNotice,
|
|
12232
|
-
|
|
12241
|
+
matchUpId,
|
|
12242
|
+
timeItem
|
|
12233
12243
|
});
|
|
12234
12244
|
}
|
|
12235
12245
|
function addMatchUpOfficial$2({
|
|
12236
12246
|
drawDefinition,
|
|
12237
|
-
matchUpId,
|
|
12238
12247
|
disableNotice,
|
|
12239
12248
|
participantId,
|
|
12240
|
-
officialType
|
|
12249
|
+
officialType,
|
|
12250
|
+
matchUpId
|
|
12241
12251
|
}) {
|
|
12242
12252
|
if (!matchUpId) return {
|
|
12243
12253
|
error: MISSING_MATCHUP_ID
|
|
@@ -12249,11 +12259,11 @@ function addMatchUpOfficial$2({
|
|
|
12249
12259
|
itemValue: participantId
|
|
12250
12260
|
};
|
|
12251
12261
|
return addMatchUpTimeItem({
|
|
12262
|
+
duplicateValues: false,
|
|
12252
12263
|
drawDefinition,
|
|
12253
|
-
matchUpId,
|
|
12254
|
-
timeItem,
|
|
12255
12264
|
disableNotice,
|
|
12256
|
-
|
|
12265
|
+
matchUpId,
|
|
12266
|
+
timeItem
|
|
12257
12267
|
});
|
|
12258
12268
|
}
|
|
12259
12269
|
function addMatchUpStartTime$2({
|
|
@@ -12290,11 +12300,11 @@ function addMatchUpStartTime$2({
|
|
|
12290
12300
|
itemValue: startTime
|
|
12291
12301
|
};
|
|
12292
12302
|
return addMatchUpTimeItem({
|
|
12303
|
+
duplicateValues: false,
|
|
12293
12304
|
drawDefinition,
|
|
12294
|
-
matchUpId,
|
|
12295
|
-
timeItem,
|
|
12296
12305
|
disableNotice,
|
|
12297
|
-
|
|
12306
|
+
matchUpId,
|
|
12307
|
+
timeItem
|
|
12298
12308
|
});
|
|
12299
12309
|
} else {
|
|
12300
12310
|
return {
|
|
@@ -12336,11 +12346,11 @@ function addMatchUpEndTime$2({
|
|
|
12336
12346
|
itemValue: endTime
|
|
12337
12347
|
};
|
|
12338
12348
|
return addMatchUpTimeItem({
|
|
12349
|
+
duplicateValues: false,
|
|
12339
12350
|
drawDefinition,
|
|
12340
|
-
matchUpId,
|
|
12341
|
-
timeItem,
|
|
12342
12351
|
disableNotice,
|
|
12343
|
-
|
|
12352
|
+
matchUpId,
|
|
12353
|
+
timeItem
|
|
12344
12354
|
});
|
|
12345
12355
|
} else {
|
|
12346
12356
|
return {
|
|
@@ -12393,11 +12403,11 @@ function addMatchUpStopTime$2({
|
|
|
12393
12403
|
itemValue: stopTime
|
|
12394
12404
|
};
|
|
12395
12405
|
return addMatchUpTimeItem({
|
|
12406
|
+
duplicateValues: true,
|
|
12396
12407
|
drawDefinition,
|
|
12397
|
-
matchUpId,
|
|
12398
|
-
timeItem,
|
|
12399
12408
|
disableNotice,
|
|
12400
|
-
|
|
12409
|
+
matchUpId,
|
|
12410
|
+
timeItem
|
|
12401
12411
|
});
|
|
12402
12412
|
} else {
|
|
12403
12413
|
return {
|
|
@@ -12450,11 +12460,11 @@ function addMatchUpResumeTime$2({
|
|
|
12450
12460
|
itemValue: resumeTime
|
|
12451
12461
|
};
|
|
12452
12462
|
return addMatchUpTimeItem({
|
|
12463
|
+
duplicateValues: true,
|
|
12453
12464
|
drawDefinition,
|
|
12454
|
-
matchUpId,
|
|
12455
|
-
timeItem,
|
|
12456
12465
|
disableNotice,
|
|
12457
|
-
|
|
12466
|
+
matchUpId,
|
|
12467
|
+
timeItem
|
|
12458
12468
|
});
|
|
12459
12469
|
} else {
|
|
12460
12470
|
return {
|
|
@@ -14127,12 +14137,118 @@ function getProjectedDualWinningSide({
|
|
|
14127
14137
|
};
|
|
14128
14138
|
}
|
|
14129
14139
|
|
|
14140
|
+
function analyzeScore({
|
|
14141
|
+
existingMatchUpStatus,
|
|
14142
|
+
matchUpFormat,
|
|
14143
|
+
matchUpStatus,
|
|
14144
|
+
winningSide,
|
|
14145
|
+
score
|
|
14146
|
+
}) {
|
|
14147
|
+
const sets = score === null || score === void 0 ? void 0 : score.sets;
|
|
14148
|
+
const completedSets = (sets === null || sets === void 0 ? void 0 : sets.filter(set => set === null || set === void 0 ? void 0 : set.winningSide)) || [];
|
|
14149
|
+
const setsWinCounts = completedSets.reduce((counts, set) => {
|
|
14150
|
+
const {
|
|
14151
|
+
winningSide
|
|
14152
|
+
} = set;
|
|
14153
|
+
const winningSideIndex = winningSide - 1;
|
|
14154
|
+
counts[winningSideIndex]++;
|
|
14155
|
+
return counts;
|
|
14156
|
+
}, [0, 0]);
|
|
14157
|
+
const matchUpWinningSideIndex = winningSide && winningSide - 1;
|
|
14158
|
+
const matchUpLosingSideIndex = 1 - matchUpWinningSideIndex;
|
|
14159
|
+
const winningSideSetsCount = setsWinCounts[matchUpWinningSideIndex];
|
|
14160
|
+
const losingSideSetsCount = setsWinCounts[matchUpLosingSideIndex];
|
|
14161
|
+
const matchUpScoringFormat = parse(matchUpFormat);
|
|
14162
|
+
const maxSetsCount = Math.max(...setsWinCounts);
|
|
14163
|
+
const maxSetsInstances = instanceCount(setsWinCounts)[maxSetsCount];
|
|
14164
|
+
const {
|
|
14165
|
+
bestOf
|
|
14166
|
+
} = matchUpScoringFormat || {};
|
|
14167
|
+
const setsToWin = bestOf && Math.ceil(bestOf / 2) || 1;
|
|
14168
|
+
const relevantMatchUpStatus = matchUpStatus || existingMatchUpStatus;
|
|
14169
|
+
const irregularEnding = [DEFAULTED, RETIRED, WALKOVER$1].includes(relevantMatchUpStatus);
|
|
14170
|
+
const calculatedWinningSide = (!matchUpFormat || maxSetsCount === setsToWin) && maxSetsInstances === 1 && setsWinCounts.indexOf(maxSetsCount) + 1 || undefined;
|
|
14171
|
+
const validMatchUpWinningSide = winningSide && winningSideSetsCount > losingSideSetsCount && winningSide === calculatedWinningSide || !winningSide && !calculatedWinningSide || irregularEnding;
|
|
14172
|
+
return validMatchUpWinningSide;
|
|
14173
|
+
}
|
|
14174
|
+
|
|
14130
14175
|
function validateScore({
|
|
14176
|
+
existingMatchUpStatus,
|
|
14177
|
+
matchUpFormat,
|
|
14178
|
+
matchUpStatus,
|
|
14179
|
+
winningSide,
|
|
14131
14180
|
score
|
|
14132
14181
|
}) {
|
|
14133
14182
|
if (typeof score !== 'object') return {
|
|
14134
14183
|
error: INVALID_VALUES
|
|
14135
14184
|
};
|
|
14185
|
+
const {
|
|
14186
|
+
sets,
|
|
14187
|
+
scoreStringSide1,
|
|
14188
|
+
scoreStringSide2
|
|
14189
|
+
} = score;
|
|
14190
|
+
if (scoreStringSide1 !== undefined && typeof scoreStringSide1 !== 'string') return {
|
|
14191
|
+
error: INVALID_VALUES,
|
|
14192
|
+
message: 'scoreString must be a string!'
|
|
14193
|
+
};
|
|
14194
|
+
if (scoreStringSide2 !== undefined && typeof scoreStringSide2 !== 'string') return {
|
|
14195
|
+
error: INVALID_VALUES,
|
|
14196
|
+
message: 'scoreString must be a string!'
|
|
14197
|
+
};
|
|
14198
|
+
if (sets !== undefined && !Array.isArray(sets)) return {
|
|
14199
|
+
error: INVALID_VALUES,
|
|
14200
|
+
message: 'sets must be an array'
|
|
14201
|
+
};
|
|
14202
|
+
|
|
14203
|
+
if (sets !== null && sets !== void 0 && sets.length) {
|
|
14204
|
+
const setNumbers = sets.map(set => set === null || set === void 0 ? void 0 : set.setNumber);
|
|
14205
|
+
if (setNumbers.length !== unique(setNumbers).length) return {
|
|
14206
|
+
error: INVALID_VALUES,
|
|
14207
|
+
message: 'setNumbers not unique'
|
|
14208
|
+
};
|
|
14209
|
+
|
|
14210
|
+
for (const set of sets) {
|
|
14211
|
+
const {
|
|
14212
|
+
side1Score,
|
|
14213
|
+
side2Score,
|
|
14214
|
+
side1TiebreakScore,
|
|
14215
|
+
side2TiebreakScore,
|
|
14216
|
+
side1PointScore,
|
|
14217
|
+
side2PointScore,
|
|
14218
|
+
winningSide,
|
|
14219
|
+
setNumber
|
|
14220
|
+
} = set;
|
|
14221
|
+
const numericValues = [side1Score, side2Score, side1TiebreakScore, side2TiebreakScore, side1PointScore, side2PointScore, setNumber, winningSide].filter(value => value !== undefined).every(numericValue => isConvertableInteger(numericValue));
|
|
14222
|
+
|
|
14223
|
+
if (!numericValues) {
|
|
14224
|
+
return {
|
|
14225
|
+
error: INVALID_VALUES,
|
|
14226
|
+
message: 'non-numeric values'
|
|
14227
|
+
};
|
|
14228
|
+
}
|
|
14229
|
+
|
|
14230
|
+
if (winningSide && ![1, 2].includes(winningSide)) return {
|
|
14231
|
+
error: INVALID_VALUES,
|
|
14232
|
+
message: 'winningSide must be 1 or 2'
|
|
14233
|
+
};
|
|
14234
|
+
}
|
|
14235
|
+
|
|
14236
|
+
const isValidScore = analyzeScore({
|
|
14237
|
+
existingMatchUpStatus,
|
|
14238
|
+
matchUpStatus,
|
|
14239
|
+
matchUpFormat,
|
|
14240
|
+
winningSide,
|
|
14241
|
+
score
|
|
14242
|
+
});
|
|
14243
|
+
|
|
14244
|
+
if (!isValidScore) {
|
|
14245
|
+
return {
|
|
14246
|
+
error: INVALID_WINNING_SIDE,
|
|
14247
|
+
message: 'winningSide does not match analyzed score'
|
|
14248
|
+
};
|
|
14249
|
+
}
|
|
14250
|
+
}
|
|
14251
|
+
|
|
14136
14252
|
return {
|
|
14137
14253
|
valid: true
|
|
14138
14254
|
};
|
|
@@ -15716,12 +15832,12 @@ function drawPositionRemovals({
|
|
|
15716
15832
|
}
|
|
15717
15833
|
|
|
15718
15834
|
function removeSubsequentRoundsParticipant({
|
|
15719
|
-
|
|
15720
|
-
structureId,
|
|
15721
|
-
roundNumber,
|
|
15835
|
+
inContextDrawMatchUps,
|
|
15722
15836
|
targetDrawPosition,
|
|
15837
|
+
drawDefinition,
|
|
15723
15838
|
matchUpsMap,
|
|
15724
|
-
|
|
15839
|
+
roundNumber,
|
|
15840
|
+
structureId
|
|
15725
15841
|
}) {
|
|
15726
15842
|
var _matchUpsMap;
|
|
15727
15843
|
|
|
@@ -15751,24 +15867,24 @@ function removeSubsequentRoundsParticipant({
|
|
|
15751
15867
|
structureId
|
|
15752
15868
|
});
|
|
15753
15869
|
relevantMatchUps === null || relevantMatchUps === void 0 ? void 0 : relevantMatchUps.forEach(matchUp => removeDrawPosition({
|
|
15754
|
-
targetMatchUp: matchUp,
|
|
15755
15870
|
drawPosition: targetDrawPosition,
|
|
15871
|
+
targetMatchUp: matchUp,
|
|
15872
|
+
inContextDrawMatchUps,
|
|
15756
15873
|
positionAssignments,
|
|
15757
15874
|
drawDefinition,
|
|
15758
|
-
structure,
|
|
15759
15875
|
matchUpsMap,
|
|
15760
|
-
|
|
15876
|
+
structure
|
|
15761
15877
|
}));
|
|
15762
15878
|
}
|
|
15763
15879
|
|
|
15764
15880
|
function removeDrawPosition({
|
|
15881
|
+
inContextDrawMatchUps,
|
|
15765
15882
|
positionAssignments,
|
|
15883
|
+
drawDefinition,
|
|
15766
15884
|
targetMatchUp,
|
|
15767
15885
|
drawPosition,
|
|
15768
|
-
|
|
15769
|
-
structure
|
|
15770
|
-
inContextDrawMatchUps,
|
|
15771
|
-
matchUpsMap
|
|
15886
|
+
matchUpsMap,
|
|
15887
|
+
structure
|
|
15772
15888
|
}) {
|
|
15773
15889
|
matchUpsMap = matchUpsMap || getMatchUpsMap({
|
|
15774
15890
|
drawDefinition
|
|
@@ -16698,9 +16814,6 @@ function removeDirectedLoser({
|
|
|
16698
16814
|
|
|
16699
16815
|
if (targetSide) {
|
|
16700
16816
|
delete targetSide.lineUp;
|
|
16701
|
-
console.log('remove loser lineUp', {
|
|
16702
|
-
targetSide
|
|
16703
|
-
});
|
|
16704
16817
|
modifyMatchUpNotice({
|
|
16705
16818
|
drawDefinition,
|
|
16706
16819
|
matchUp: targetMatchUp
|
|
@@ -19898,16 +20011,6 @@ function setMatchUpStatus$2(params) {
|
|
|
19898
20011
|
})); // Find target matchUp ------------------------------------------------------
|
|
19899
20012
|
|
|
19900
20013
|
const matchUp = matchUpsMap.drawMatchUps.find(matchUp => matchUp.matchUpId === matchUpId);
|
|
19901
|
-
|
|
19902
|
-
if (score) {
|
|
19903
|
-
const result = validateScore({
|
|
19904
|
-
score,
|
|
19905
|
-
matchUp,
|
|
19906
|
-
winningSide
|
|
19907
|
-
});
|
|
19908
|
-
if (result.error) return result;
|
|
19909
|
-
}
|
|
19910
|
-
|
|
19911
20014
|
const inContextMatchUp = inContextDrawMatchUps.find(matchUp => matchUp.matchUpId === matchUpId);
|
|
19912
20015
|
if (!matchUp || !inContextDrawMatchUps) return {
|
|
19913
20016
|
error: MATCHUP_NOT_FOUND
|
|
@@ -19944,7 +20047,24 @@ function setMatchUpStatus$2(params) {
|
|
|
19944
20047
|
} = findStructure({
|
|
19945
20048
|
drawDefinition,
|
|
19946
20049
|
structureId
|
|
19947
|
-
});
|
|
20050
|
+
}); // not yet validating tieMatchUps
|
|
20051
|
+
|
|
20052
|
+
if (score && matchUp.matchUpType !== TEAM$3 && !matchUp.collectionId) {
|
|
20053
|
+
const matchUpFormat = matchUp.matchUpFormat || (structure === null || structure === void 0 ? void 0 : structure.matchUpFormat) || (drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.matchUpFormat) || (event === null || event === void 0 ? void 0 : event.matchUpFormat);
|
|
20054
|
+
const result = validateScore({
|
|
20055
|
+
existingMatchUpStatus: matchUp.matchUpStatus,
|
|
20056
|
+
matchUpFormat,
|
|
20057
|
+
matchUpStatus,
|
|
20058
|
+
winningSide,
|
|
20059
|
+
score
|
|
20060
|
+
});
|
|
20061
|
+
|
|
20062
|
+
if (result.error) {
|
|
20063
|
+
// console.log({ matchUp, result, winningSide }, score);
|
|
20064
|
+
return result;
|
|
20065
|
+
}
|
|
20066
|
+
}
|
|
20067
|
+
|
|
19948
20068
|
const bothSideParticipants = ((_matchUp$sides = matchUp.sides) === null || _matchUp$sides === void 0 ? void 0 : _matchUp$sides.map(side => side.participantId).filter(Boolean).length) === 2 || (assignedDrawPositions === null || assignedDrawPositions === void 0 ? void 0 : assignedDrawPositions.length) === 2;
|
|
19949
20069
|
|
|
19950
20070
|
if (matchUpStatus && particicipantsRequiredMatchUpStatuses.includes(matchUpStatus) && !bothSideParticipants) {
|
|
@@ -22169,8 +22289,10 @@ function addParticipantContext(params) {
|
|
|
22169
22289
|
|
|
22170
22290
|
allTournamentParticipants.forEach(participant => {
|
|
22171
22291
|
if (participant.participantType === GROUP) {
|
|
22292
|
+
var _participant$individu;
|
|
22293
|
+
|
|
22172
22294
|
const groupParticipantId = participant.participantId;
|
|
22173
|
-
participant.individualParticipantIds.forEach(participantId => {
|
|
22295
|
+
(_participant$individu = participant.individualParticipantIds) === null || _participant$individu === void 0 ? void 0 : _participant$individu.forEach(participantId => {
|
|
22174
22296
|
if (!participantIdMap[participantId].groupParticipantIds.includes(groupParticipantId)) {
|
|
22175
22297
|
participantIdMap[participantId].groupParticipantIds.push(groupParticipantId);
|
|
22176
22298
|
participantIdMap[participantId].groups.push({
|
|
@@ -22184,8 +22306,10 @@ function addParticipantContext(params) {
|
|
|
22184
22306
|
}
|
|
22185
22307
|
|
|
22186
22308
|
if (participant.participantType === TEAM$3) {
|
|
22309
|
+
var _participant$individu2;
|
|
22310
|
+
|
|
22187
22311
|
const teamParticipantId = participant.participantId;
|
|
22188
|
-
participant.individualParticipantIds.forEach(participantId => {
|
|
22312
|
+
(_participant$individu2 = participant.individualParticipantIds) === null || _participant$individu2 === void 0 ? void 0 : _participant$individu2.forEach(participantId => {
|
|
22189
22313
|
if (!participantIdMap[participantId].teamParticipantIds.includes(teamParticipantId)) {
|
|
22190
22314
|
participantIdMap[participantId].teamParticipantIds.push(teamParticipantId);
|
|
22191
22315
|
participantIdMap[participantId].teams.push({
|
|
@@ -22200,8 +22324,10 @@ function addParticipantContext(params) {
|
|
|
22200
22324
|
}
|
|
22201
22325
|
|
|
22202
22326
|
if (participant.participantType === PAIR$1) {
|
|
22327
|
+
var _participant$individu3;
|
|
22328
|
+
|
|
22203
22329
|
const pairParticipantId = participant.participantId;
|
|
22204
|
-
participant.individualParticipantIds.forEach(participantId => {
|
|
22330
|
+
(_participant$individu3 = participant.individualParticipantIds) === null || _participant$individu3 === void 0 ? void 0 : _participant$individu3.forEach(participantId => {
|
|
22205
22331
|
if (!participantIdMap[participantId].pairParticipantIds.includes(pairParticipantId)) {
|
|
22206
22332
|
participantIdMap[participantId].pairParticipantIds.push(pairParticipantId);
|
|
22207
22333
|
}
|
|
@@ -40986,18 +41112,24 @@ function modifyParticipant({
|
|
|
40986
41112
|
participant
|
|
40987
41113
|
});
|
|
40988
41114
|
const {
|
|
41115
|
+
participantRoleResponsibilties,
|
|
40989
41116
|
individualParticipantIds,
|
|
41117
|
+
participantOtherName,
|
|
40990
41118
|
participantName,
|
|
40991
41119
|
participantRole,
|
|
40992
41120
|
participantType,
|
|
40993
41121
|
onlineProfiles,
|
|
40994
41122
|
// TODO: validate onlineProfiles
|
|
41123
|
+
contacts,
|
|
41124
|
+
// TODO: validate contacts
|
|
40995
41125
|
person
|
|
40996
41126
|
} = participant;
|
|
40997
41127
|
const newValues = {}; // validate participant attributes
|
|
40998
41128
|
|
|
41129
|
+
if (contacts) newValues.contacts = contacts;
|
|
40999
41130
|
if (onlineProfiles) newValues.onlineProfiles = onlineProfiles;
|
|
41000
41131
|
if (participantName && typeof participantName === 'string') newValues.participantName = participantName;
|
|
41132
|
+
if (participantOtherName && typeof participantOtherName === 'string') newValues.participantOtherName = participantOtherName;
|
|
41001
41133
|
|
|
41002
41134
|
if (Array.isArray(individualParticipantIds)) {
|
|
41003
41135
|
const {
|
|
@@ -41030,6 +41162,7 @@ function modifyParticipant({
|
|
|
41030
41162
|
|
|
41031
41163
|
if (Object.keys(participantRoles).includes(participantRole)) newValues.participantRole = participantRole;
|
|
41032
41164
|
if (Object.keys(participantTypes).includes(participantType)) newValues.participantType = participantType;
|
|
41165
|
+
if (Array.isArray(participantRoleResponsibilties)) newValues.participantRoleResponsibilties = participantRoleResponsibilties;
|
|
41033
41166
|
|
|
41034
41167
|
if (existingParticipant.participantType === participantTypes.INDIVIDUAL && person) {
|
|
41035
41168
|
updatePerson({
|
|
@@ -41040,7 +41173,7 @@ function modifyParticipant({
|
|
|
41040
41173
|
});
|
|
41041
41174
|
}
|
|
41042
41175
|
|
|
41043
|
-
Object.assign(existingParticipant, newValues);
|
|
41176
|
+
Object.assign(existingParticipant, definedAttributes(newValues));
|
|
41044
41177
|
|
|
41045
41178
|
if (groupingParticipantId) {
|
|
41046
41179
|
addIndividualParticipantIds({
|
|
@@ -41508,6 +41641,7 @@ function getEventData({
|
|
|
41508
41641
|
withGroupings: true,
|
|
41509
41642
|
withEvents: false,
|
|
41510
41643
|
withDraws: false,
|
|
41644
|
+
withISO: true,
|
|
41511
41645
|
...participantsProfile,
|
|
41512
41646
|
// order is important!!
|
|
41513
41647
|
tournamentRecord
|
|
@@ -50039,7 +50173,7 @@ function parseScoreString({
|
|
|
50039
50173
|
const matchTiebreak = (set === null || set === void 0 ? void 0 : set.startsWith('[')) && set.split('[')[1].split(']')[0].split('-').map(sideScore => parseInt(sideScore));
|
|
50040
50174
|
const setString = set.includes('(') ? set.split('(')[0] : set.includes('[') ? set.split('[')[0] : set;
|
|
50041
50175
|
const setScores = !matchTiebreak && setString.split('-').map(sideScore => parseInt(sideScore));
|
|
50042
|
-
const winningSide = setScores[0] > setScores[1] ? 1 : setScores[0] < setScores[1] ? 2 : undefined;
|
|
50176
|
+
const winningSide = matchTiebreak ? matchTiebreak[0] > matchTiebreak[1] ? 1 : matchTiebreak[0] < matchTiebreak[1] ? 2 : undefined : setScores[0] > setScores[1] ? 1 : setScores[0] < setScores[1] ? 2 : undefined;
|
|
50043
50177
|
const setTiebreakLowScore = set.includes('(') && set.split('(')[1].split(')')[0];
|
|
50044
50178
|
const side1TiebreakPerspective = ![false, undefined].includes(setTiebreakLowScore) && getTiebreakComplement({
|
|
50045
50179
|
isSide1: winningSide === 2,
|
|
@@ -51681,6 +51815,7 @@ function generateEventWithDraw({
|
|
|
51681
51815
|
generate = true,
|
|
51682
51816
|
eventExtensions,
|
|
51683
51817
|
drawExtensions,
|
|
51818
|
+
completionGoal,
|
|
51684
51819
|
drawSize = 32,
|
|
51685
51820
|
tieFormatName,
|
|
51686
51821
|
seedsCount,
|
|
@@ -51989,15 +52124,17 @@ function generateEventWithDraw({
|
|
|
51989
52124
|
}
|
|
51990
52125
|
}
|
|
51991
52126
|
|
|
51992
|
-
if (completeAllMatchUps) {
|
|
52127
|
+
if (completeAllMatchUps || completionGoal) {
|
|
51993
52128
|
const result = completeDrawMatchUps({
|
|
51994
52129
|
matchUpStatusProfile,
|
|
51995
52130
|
completeAllMatchUps,
|
|
51996
52131
|
randomWinningSide,
|
|
52132
|
+
completionGoal,
|
|
51997
52133
|
drawDefinition,
|
|
51998
52134
|
matchUpFormat
|
|
51999
52135
|
});
|
|
52000
52136
|
if (result.error) return result;
|
|
52137
|
+
const completedCount = result.completedCount;
|
|
52001
52138
|
|
|
52002
52139
|
if (drawType === ROUND_ROBIN_WITH_PLAYOFF) {
|
|
52003
52140
|
const mainStructure = drawDefinition.structures.find(structure => structure.stage === MAIN);
|
|
@@ -52007,7 +52144,9 @@ function generateEventWithDraw({
|
|
|
52007
52144
|
drawDefinition,
|
|
52008
52145
|
event
|
|
52009
52146
|
});
|
|
52147
|
+
const playoffCompletionGoal = completionGoal ? completionGoal - completedCount : undefined;
|
|
52010
52148
|
result = completeDrawMatchUps({
|
|
52149
|
+
completionGoal: completionGoal ? playoffCompletionGoal : undefined,
|
|
52011
52150
|
matchUpStatusProfile,
|
|
52012
52151
|
completeAllMatchUps,
|
|
52013
52152
|
randomWinningSide,
|