tods-competition-factory 2.0.54 → 2.0.56
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/index.mjs +5 -5
- package/dist/tods-competition-factory.d.ts +58 -10
- package/dist/tods-competition-factory.development.cjs.js +507 -381
- 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/package.json +15 -15
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
function factoryVersion() {
|
|
6
|
-
return '2.0.
|
|
6
|
+
return '2.0.56';
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
function isFunction(obj) {
|
|
@@ -1823,6 +1823,7 @@ const PARTICIPANT_ID = 'participantId';
|
|
|
1823
1823
|
const SCHEDULE_DATES = 'scheduleDates';
|
|
1824
1824
|
const TOURNAMENT_ID = 'tournamentId';
|
|
1825
1825
|
const SCHEDULE_DATE = 'scheduleDate';
|
|
1826
|
+
const ROUND_NUMBER = 'roundNumber';
|
|
1826
1827
|
const STRUCTURE_ID = 'structureId';
|
|
1827
1828
|
const PARTICIPANT = 'participant';
|
|
1828
1829
|
const MATCHUP_IDS = 'matchUpIds';
|
|
@@ -1915,8 +1916,8 @@ function checkRequiredParameters(params, requiredParams, stack) {
|
|
|
1915
1916
|
if (!paramError)
|
|
1916
1917
|
return { valid: true };
|
|
1917
1918
|
const error = params?.[errorParam] === undefined
|
|
1918
|
-
? errors[errorParam] || paramError[ERROR] || INVALID_VALUES
|
|
1919
|
-
: (paramError[VALIDATE] && paramError[INVALID]) || INVALID_VALUES;
|
|
1919
|
+
? errors[errorParam] || paramError[ERROR] || paramError[INVALID] || INVALID_VALUES
|
|
1920
|
+
: (paramError[VALIDATE] && (paramError[ERROR] || paramError[INVALID])) || INVALID_VALUES;
|
|
1920
1921
|
const param = errorParam ?? (paramError[ONE_OF] && Object.keys(paramError[ONE_OF]).join(', '));
|
|
1921
1922
|
return decorateResult({
|
|
1922
1923
|
info: { param, message: paramError[MESSAGE] },
|
|
@@ -2098,7 +2099,7 @@ function getIsoDateString(schedule) {
|
|
|
2098
2099
|
scheduledDate = extractDate(schedule.scheduledTime);
|
|
2099
2100
|
if (!scheduledDate)
|
|
2100
2101
|
return;
|
|
2101
|
-
const extractedTime = extractTime(schedule.scheduledTime);
|
|
2102
|
+
const extractedTime = extractTime$1(schedule.scheduledTime);
|
|
2102
2103
|
let isoDateString = extractDate(scheduledDate);
|
|
2103
2104
|
if (isoDateString && extractedTime)
|
|
2104
2105
|
isoDateString += `T${extractedTime}`;
|
|
@@ -2224,8 +2225,8 @@ function isTimeString(timeString) {
|
|
|
2224
2225
|
const invalid = parts.length < 2 || !isNumeric || parseInt(parts[0]) > 23 || parseInt(parts[1]) > 60;
|
|
2225
2226
|
return !invalid;
|
|
2226
2227
|
}
|
|
2227
|
-
function timeStringMinutes(timeString) {
|
|
2228
|
-
const validTimeString = extractTime(timeString);
|
|
2228
|
+
function timeStringMinutes$1(timeString) {
|
|
2229
|
+
const validTimeString = extractTime$1(timeString);
|
|
2229
2230
|
if (!validTimeString)
|
|
2230
2231
|
return 0;
|
|
2231
2232
|
const [hours, minutes] = validTimeString.split(':').map((value) => parseInt(value));
|
|
@@ -2241,7 +2242,7 @@ function dayMinutesToTimeString(totalMinutes) {
|
|
|
2241
2242
|
function tidyTime(timeString) {
|
|
2242
2243
|
return isTimeString(timeString) ? timeString.split(':').slice(0, 2).map(zeroPad).join(':') : undefined;
|
|
2243
2244
|
}
|
|
2244
|
-
function extractTime(dateString) {
|
|
2245
|
+
function extractTime$1(dateString) {
|
|
2245
2246
|
return isISODateString(dateString) && dateString.indexOf('T') > 0
|
|
2246
2247
|
? tidyTime(dateString.split('T').reverse()[0])
|
|
2247
2248
|
: tidyTime(dateString);
|
|
@@ -2302,7 +2303,7 @@ function regularTime(value) {
|
|
|
2302
2303
|
}
|
|
2303
2304
|
function convertTime(value, time24, keepDate) {
|
|
2304
2305
|
const hasDate = extractDate(value);
|
|
2305
|
-
const timeString = extractTime(value);
|
|
2306
|
+
const timeString = extractTime$1(value);
|
|
2306
2307
|
const timeValue = hasDate ? timeString : value;
|
|
2307
2308
|
return !value
|
|
2308
2309
|
? undefined
|
|
@@ -2354,11 +2355,11 @@ function minutesDifference(date1, date2, absolute = true) {
|
|
|
2354
2355
|
return absolute ? Math.abs(Math.round(diff)) : Math.round(diff);
|
|
2355
2356
|
}
|
|
2356
2357
|
function addMinutesToTimeString(timeString, minutes) {
|
|
2357
|
-
const validTimeString = extractTime(timeString);
|
|
2358
|
+
const validTimeString = extractTime$1(timeString);
|
|
2358
2359
|
if (!validTimeString)
|
|
2359
2360
|
return '00:00';
|
|
2360
2361
|
const minutesToAdd = isNaN(minutes) ? 0 : minutes;
|
|
2361
|
-
return extractTime(addMinutes(timeToDate(validTimeString), minutesToAdd).toISOString());
|
|
2362
|
+
return extractTime$1(addMinutes(timeToDate(validTimeString), minutesToAdd).toISOString());
|
|
2362
2363
|
}
|
|
2363
2364
|
function addMinutes(startDate, minutes) {
|
|
2364
2365
|
const date = new Date(startDate);
|
|
@@ -2381,7 +2382,7 @@ const dateTime = {
|
|
|
2381
2382
|
getUTCdateString,
|
|
2382
2383
|
DateHHMM,
|
|
2383
2384
|
extractDate,
|
|
2384
|
-
extractTime,
|
|
2385
|
+
extractTime: extractTime$1,
|
|
2385
2386
|
formatDate,
|
|
2386
2387
|
getDateByWeek,
|
|
2387
2388
|
isISODateString,
|
|
@@ -2390,7 +2391,7 @@ const dateTime = {
|
|
|
2390
2391
|
offsetDate,
|
|
2391
2392
|
offsetTime,
|
|
2392
2393
|
sameDay,
|
|
2393
|
-
timeStringMinutes,
|
|
2394
|
+
timeStringMinutes: timeStringMinutes$1,
|
|
2394
2395
|
timeToDate,
|
|
2395
2396
|
timeUTC,
|
|
2396
2397
|
validTimeValue,
|
|
@@ -7268,12 +7269,12 @@ function getMatchUpScheduleDetails(params) {
|
|
|
7268
7269
|
}));
|
|
7269
7270
|
if (averageMinutes || recoveryMinutes) {
|
|
7270
7271
|
timeAfterRecovery = endTime
|
|
7271
|
-
? addMinutesToTimeString(extractTime(endTime), recoveryMinutes)
|
|
7272
|
+
? addMinutesToTimeString(extractTime$1(endTime), recoveryMinutes)
|
|
7272
7273
|
: addMinutesToTimeString(scheduledTime, averageMinutes + recoveryMinutes);
|
|
7273
7274
|
}
|
|
7274
7275
|
if (typeChangeRecoveryMinutes) {
|
|
7275
7276
|
typeChangeTimeAfterRecovery = endTime
|
|
7276
|
-
? addMinutesToTimeString(extractTime(endTime), typeChangeRecoveryMinutes)
|
|
7277
|
+
? addMinutesToTimeString(extractTime$1(endTime), typeChangeRecoveryMinutes)
|
|
7277
7278
|
: addMinutesToTimeString(scheduledTime, averageMinutes + typeChangeRecoveryMinutes);
|
|
7278
7279
|
}
|
|
7279
7280
|
}
|
|
@@ -9458,14 +9459,14 @@ function addUpcomingMatchUps({ drawDefinition, inContextDrawMatchUps }) {
|
|
|
9458
9459
|
const timeAfterRecovery = inContextMatchUp.schedule?.timeAfterRecovery;
|
|
9459
9460
|
if (timeAfterRecovery) {
|
|
9460
9461
|
if (winnerTo?.schedule?.scheduledTime) {
|
|
9461
|
-
const scheduleConflict = timeStringMinutes(winnerTo.schedule.scheduledTime) < timeStringMinutes(timeAfterRecovery);
|
|
9462
|
+
const scheduleConflict = timeStringMinutes$1(winnerTo.schedule.scheduledTime) < timeStringMinutes$1(timeAfterRecovery);
|
|
9462
9463
|
if (scheduleConflict) {
|
|
9463
9464
|
scheduleConflictMatchUpIds[winnerTo.matchUpId] = inContextMatchUp.matchUpId;
|
|
9464
9465
|
winnerTo.schedule.scheduleConflict = inContextMatchUp.matchUpId;
|
|
9465
9466
|
}
|
|
9466
9467
|
}
|
|
9467
9468
|
if (loserTo?.schedule?.scheduledTime) {
|
|
9468
|
-
const scheduleConflict = timeStringMinutes(loserTo.schedule.scheduledTime) < timeStringMinutes(timeAfterRecovery);
|
|
9469
|
+
const scheduleConflict = timeStringMinutes$1(loserTo.schedule.scheduledTime) < timeStringMinutes$1(timeAfterRecovery);
|
|
9469
9470
|
if (scheduleConflict) {
|
|
9470
9471
|
scheduleConflictMatchUpIds[loserTo.matchUpId] = inContextMatchUp.matchUpId;
|
|
9471
9472
|
loserTo.schedule.scheduleConflict = inContextMatchUp.matchUpId;
|
|
@@ -11517,7 +11518,7 @@ function addScheduleItem(params) {
|
|
|
11517
11518
|
participantMap[participantId].scheduleItems.push({
|
|
11518
11519
|
...schedule,
|
|
11519
11520
|
scheduledDate: extractDate(schedule?.scheduledDate),
|
|
11520
|
-
scheduledTime: extractTime(schedule?.scheduledTime),
|
|
11521
|
+
scheduledTime: extractTime$1(schedule?.scheduledTime),
|
|
11521
11522
|
checkScoreHasValue: checkScoreHasValue({ score }),
|
|
11522
11523
|
matchUpStatus,
|
|
11523
11524
|
roundPosition,
|
|
@@ -12314,7 +12315,7 @@ function getParticipantEntries(params) {
|
|
|
12314
12315
|
for (const scheduleItem of scheduleItems) {
|
|
12315
12316
|
const { typeChangeTimeAfterRecovery, timeAfterRecovery, scheduledDate, scheduledTime } = scheduleItem;
|
|
12316
12317
|
const scheduleItemsToConsider = dateItems[scheduledDate];
|
|
12317
|
-
const scheduledMinutes = timeStringMinutes(scheduledTime);
|
|
12318
|
+
const scheduledMinutes = timeStringMinutes$1(scheduledTime);
|
|
12318
12319
|
for (const consideredItem of scheduleItemsToConsider) {
|
|
12319
12320
|
const ignoreItem = consideredItem.matchUpId === scheduleItem.matchUpId ||
|
|
12320
12321
|
([WALKOVER$2, DEFAULTED].includes(consideredItem.matchUpStatus) && !consideredItem.checkScoreHasValue);
|
|
@@ -12324,12 +12325,12 @@ function getParticipantEntries(params) {
|
|
|
12324
12325
|
const notBeforeTime = typeChange ? typeChangeTimeAfterRecovery || timeAfterRecovery : timeAfterRecovery;
|
|
12325
12326
|
const sameDraw = scheduleItem.drawId === consideredItem.drawId;
|
|
12326
12327
|
const bothPotential = potentialMatchUps[scheduleItem.matchUpId] && potentialMatchUps[consideredItem.matchUpId];
|
|
12327
|
-
const consideredMinutes = timeStringMinutes(consideredItem.scheduledTime);
|
|
12328
|
+
const consideredMinutes = timeStringMinutes$1(consideredItem.scheduledTime);
|
|
12328
12329
|
const minutesDifference = Math.abs(consideredMinutes - scheduledMinutes);
|
|
12329
12330
|
const itemIsPrior = consideredMinutes >= scheduledMinutes;
|
|
12330
12331
|
const timeOverlap = scheduledMinutesDifference && !isNaN(scheduledMinutesDifference)
|
|
12331
12332
|
? minutesDifference <= scheduledMinutesDifference
|
|
12332
|
-
: itemIsPrior && timeStringMinutes(consideredItem.scheduledTime) < timeStringMinutes(notBeforeTime);
|
|
12333
|
+
: itemIsPrior && timeStringMinutes$1(consideredItem.scheduledTime) < timeStringMinutes$1(notBeforeTime);
|
|
12333
12334
|
if (timeOverlap && !(bothPotential && sameDraw) && itemIsPrior) {
|
|
12334
12335
|
const key = [scheduleItem.matchUpId, consideredItem.matchUpId].sort(stringSort).join('|');
|
|
12335
12336
|
participantAggregator.scheduleConflicts[key] = {
|
|
@@ -13200,9 +13201,10 @@ function addEventEntries(params) {
|
|
|
13200
13201
|
entries: event.entries || [],
|
|
13201
13202
|
});
|
|
13202
13203
|
}
|
|
13203
|
-
const addedEntriesCount = addedParticipantIdEntries.length
|
|
13204
|
+
const addedEntriesCount = addedParticipantIdEntries.length;
|
|
13205
|
+
const removedEntriesCount = removedEntries.length;
|
|
13204
13206
|
return decorateResult({
|
|
13205
|
-
result: { ...SUCCESS, addedEntriesCount },
|
|
13207
|
+
result: { ...SUCCESS, addedEntriesCount, removedEntriesCount },
|
|
13206
13208
|
stack,
|
|
13207
13209
|
info,
|
|
13208
13210
|
});
|
|
@@ -15561,250 +15563,6 @@ function qualifierDrawPositionAssignment(params) {
|
|
|
15561
15563
|
return qualifierDrawPositionAssignment$1(params);
|
|
15562
15564
|
}
|
|
15563
15565
|
|
|
15564
|
-
function swapDrawPositionAssignments$1({ tournamentRecord, drawDefinition, drawPositions, structureId, event }) {
|
|
15565
|
-
if (!drawDefinition)
|
|
15566
|
-
return { error: MISSING_DRAW_DEFINITION };
|
|
15567
|
-
if (!structureId)
|
|
15568
|
-
return { error: MISSING_STRUCTURE_ID };
|
|
15569
|
-
if (drawPositions?.length !== 2)
|
|
15570
|
-
return { error: INVALID_VALUES, drawPositions };
|
|
15571
|
-
const matchUpsMap = getMatchUpsMap({ drawDefinition });
|
|
15572
|
-
const { matchUps: inContextDrawMatchUps } = getAllDrawMatchUps({
|
|
15573
|
-
inContext: true,
|
|
15574
|
-
drawDefinition,
|
|
15575
|
-
matchUpsMap,
|
|
15576
|
-
});
|
|
15577
|
-
const { structure } = findStructure({ drawDefinition, structureId });
|
|
15578
|
-
if (!structure)
|
|
15579
|
-
return { error: STRUCTURE_NOT_FOUND };
|
|
15580
|
-
const appliedPolicies = getAppliedPolicies({
|
|
15581
|
-
tournamentRecord,
|
|
15582
|
-
drawDefinition,
|
|
15583
|
-
event,
|
|
15584
|
-
}).appliedPolicies ?? {};
|
|
15585
|
-
let result;
|
|
15586
|
-
if (structure.structureType === CONTAINER) {
|
|
15587
|
-
result = roundRobinSwap({
|
|
15588
|
-
inContextDrawMatchUps,
|
|
15589
|
-
tournamentRecord,
|
|
15590
|
-
drawDefinition,
|
|
15591
|
-
drawPositions,
|
|
15592
|
-
matchUpsMap,
|
|
15593
|
-
structure,
|
|
15594
|
-
event,
|
|
15595
|
-
});
|
|
15596
|
-
}
|
|
15597
|
-
else {
|
|
15598
|
-
result = eliminationSwap({
|
|
15599
|
-
inContextDrawMatchUps,
|
|
15600
|
-
tournamentRecord,
|
|
15601
|
-
drawDefinition,
|
|
15602
|
-
drawPositions,
|
|
15603
|
-
matchUpsMap,
|
|
15604
|
-
structure,
|
|
15605
|
-
event,
|
|
15606
|
-
});
|
|
15607
|
-
}
|
|
15608
|
-
if (result.error)
|
|
15609
|
-
return result;
|
|
15610
|
-
conditionallyDisableLinkPositioning({ structure, drawPositions });
|
|
15611
|
-
const positionAction = {
|
|
15612
|
-
name: 'swapDrawPositionAssignments',
|
|
15613
|
-
drawPositions,
|
|
15614
|
-
structureId,
|
|
15615
|
-
};
|
|
15616
|
-
addPositionActionTelemetry({ appliedPolicies, drawDefinition, positionAction });
|
|
15617
|
-
modifyPositionAssignmentsNotice({
|
|
15618
|
-
tournamentId: tournamentRecord?.tournamentId,
|
|
15619
|
-
drawDefinition,
|
|
15620
|
-
structure,
|
|
15621
|
-
event,
|
|
15622
|
-
});
|
|
15623
|
-
if (event.eventType === TEAM_EVENT) {
|
|
15624
|
-
const inContextTargetMatchUps = getAllStructureMatchUps({
|
|
15625
|
-
matchUpFilters: { matchUpTypes: [TEAM_MATCHUP] },
|
|
15626
|
-
inContext: true,
|
|
15627
|
-
structure,
|
|
15628
|
-
}).matchUps.filter((matchUp) => matchUp.drawPositions?.some((drawPosition) => drawPositions.includes(drawPosition)));
|
|
15629
|
-
const structureMatchUps = getAllStructureMatchUps({
|
|
15630
|
-
matchUpFilters: { matchUpTypes: [TEAM_MATCHUP] },
|
|
15631
|
-
structure,
|
|
15632
|
-
}).matchUps;
|
|
15633
|
-
inContextTargetMatchUps.forEach((inContextTargetMatchUp) => {
|
|
15634
|
-
(inContextTargetMatchUp.sides || []).forEach((inContextSide) => {
|
|
15635
|
-
const drawPosition = inContextSide?.drawPosition;
|
|
15636
|
-
if (drawPositions.includes(drawPosition)) {
|
|
15637
|
-
const teamParticipantId = inContextSide.participantId;
|
|
15638
|
-
const matchUp = structureMatchUps.find(({ matchUpId }) => matchUpId === inContextTargetMatchUp.matchUpId);
|
|
15639
|
-
const drawPositionSideIndex = inContextTargetMatchUp?.sides?.reduce((index, side, i) => (side.drawPosition === drawPosition ? i : index), undefined);
|
|
15640
|
-
updateSideLineUp({
|
|
15641
|
-
inContextTargetMatchUp,
|
|
15642
|
-
drawPositionSideIndex,
|
|
15643
|
-
teamParticipantId,
|
|
15644
|
-
tournamentRecord,
|
|
15645
|
-
drawDefinition,
|
|
15646
|
-
matchUp,
|
|
15647
|
-
event,
|
|
15648
|
-
});
|
|
15649
|
-
}
|
|
15650
|
-
});
|
|
15651
|
-
});
|
|
15652
|
-
}
|
|
15653
|
-
modifyDrawNotice({ drawDefinition, structureIds: [structureId] });
|
|
15654
|
-
return { ...SUCCESS };
|
|
15655
|
-
}
|
|
15656
|
-
function eliminationSwap({ inContextDrawMatchUps, tournamentRecord, drawDefinition, drawPositions, matchUpsMap, structure, event, }) {
|
|
15657
|
-
const assignments = structure?.positionAssignments.filter((assignment) => drawPositions?.includes(assignment.drawPosition));
|
|
15658
|
-
if (!assignments) {
|
|
15659
|
-
return {
|
|
15660
|
-
error: INVALID_VALUES,
|
|
15661
|
-
structure,
|
|
15662
|
-
info: 'Missing positionAssignments',
|
|
15663
|
-
};
|
|
15664
|
-
}
|
|
15665
|
-
if (assignments.filter(({ bye }) => bye).length === 2)
|
|
15666
|
-
return { ...SUCCESS };
|
|
15667
|
-
if (assignments.filter(({ qualifier }) => qualifier).length === 2)
|
|
15668
|
-
return { ...SUCCESS };
|
|
15669
|
-
const isQualifierSwap = assignments.some(({ qualifier }) => qualifier);
|
|
15670
|
-
const isByeSwap = assignments.some(({ bye }) => bye);
|
|
15671
|
-
if (isByeSwap && !isQualifierSwap) {
|
|
15672
|
-
return swapParticipantIdWithBYE({
|
|
15673
|
-
inContextDrawMatchUps,
|
|
15674
|
-
tournamentRecord,
|
|
15675
|
-
drawDefinition,
|
|
15676
|
-
assignments,
|
|
15677
|
-
matchUpsMap,
|
|
15678
|
-
structure,
|
|
15679
|
-
event,
|
|
15680
|
-
});
|
|
15681
|
-
}
|
|
15682
|
-
else {
|
|
15683
|
-
return eliminationPosiitonSwap({
|
|
15684
|
-
inContextDrawMatchUps,
|
|
15685
|
-
tournamentRecord,
|
|
15686
|
-
drawDefinition,
|
|
15687
|
-
assignments,
|
|
15688
|
-
matchUpsMap,
|
|
15689
|
-
structure,
|
|
15690
|
-
event,
|
|
15691
|
-
});
|
|
15692
|
-
}
|
|
15693
|
-
}
|
|
15694
|
-
function swapParticipantIdWithBYE({ inContextDrawMatchUps, tournamentRecord, drawDefinition, assignments, matchUpsMap, structure, event, }) {
|
|
15695
|
-
const originalByeAssignment = assignments.find(({ bye }) => bye);
|
|
15696
|
-
const originalParticipantIdAssignment = assignments.find(({ participantId }) => participantId);
|
|
15697
|
-
const originalByeDrawPosition = originalByeAssignment.drawPosition;
|
|
15698
|
-
const { participantId, drawPosition: originalParticipantIdDrawPosition } = originalParticipantIdAssignment;
|
|
15699
|
-
const { structureId } = structure;
|
|
15700
|
-
let result = removeDrawPositionAssignment({
|
|
15701
|
-
drawPosition: originalByeDrawPosition,
|
|
15702
|
-
inContextDrawMatchUps,
|
|
15703
|
-
tournamentRecord,
|
|
15704
|
-
drawDefinition,
|
|
15705
|
-
structureId,
|
|
15706
|
-
matchUpsMap,
|
|
15707
|
-
});
|
|
15708
|
-
if (result.error)
|
|
15709
|
-
return result;
|
|
15710
|
-
result = removeDrawPositionAssignment({
|
|
15711
|
-
drawPosition: originalParticipantIdDrawPosition,
|
|
15712
|
-
inContextDrawMatchUps,
|
|
15713
|
-
tournamentRecord,
|
|
15714
|
-
drawDefinition,
|
|
15715
|
-
structureId,
|
|
15716
|
-
matchUpsMap,
|
|
15717
|
-
});
|
|
15718
|
-
if (result.error)
|
|
15719
|
-
return result;
|
|
15720
|
-
assignDrawPositionBye({
|
|
15721
|
-
drawPosition: originalParticipantIdDrawPosition,
|
|
15722
|
-
tournamentRecord,
|
|
15723
|
-
drawDefinition,
|
|
15724
|
-
structureId,
|
|
15725
|
-
matchUpsMap,
|
|
15726
|
-
event,
|
|
15727
|
-
});
|
|
15728
|
-
result = assignDrawPosition$1({
|
|
15729
|
-
drawPosition: originalByeDrawPosition,
|
|
15730
|
-
inContextDrawMatchUps,
|
|
15731
|
-
tournamentRecord,
|
|
15732
|
-
drawDefinition,
|
|
15733
|
-
structureId,
|
|
15734
|
-
participantId,
|
|
15735
|
-
matchUpsMap,
|
|
15736
|
-
event,
|
|
15737
|
-
});
|
|
15738
|
-
if (result.error)
|
|
15739
|
-
return result;
|
|
15740
|
-
return { ...SUCCESS };
|
|
15741
|
-
}
|
|
15742
|
-
function eliminationPosiitonSwap({ inContextDrawMatchUps, tournamentRecord, drawDefinition, assignments, matchUpsMap, structure, event, }) {
|
|
15743
|
-
const newAssignments = Object.assign({}, ...assignments.map((assignment, index) => {
|
|
15744
|
-
const { drawPosition } = assignment;
|
|
15745
|
-
const newAssignment = { ...assignments[1 - index], drawPosition };
|
|
15746
|
-
return { [drawPosition]: newAssignment };
|
|
15747
|
-
}));
|
|
15748
|
-
structure.positionAssignments = structure.positionAssignments.map((assignment) => newAssignments[assignment.drawPosition] || assignment);
|
|
15749
|
-
resetLineUps({
|
|
15750
|
-
inContextDrawMatchUps,
|
|
15751
|
-
tournamentRecord,
|
|
15752
|
-
drawDefinition,
|
|
15753
|
-
matchUpsMap,
|
|
15754
|
-
assignments,
|
|
15755
|
-
structure,
|
|
15756
|
-
event,
|
|
15757
|
-
});
|
|
15758
|
-
return { ...SUCCESS };
|
|
15759
|
-
}
|
|
15760
|
-
function roundRobinSwap({ inContextDrawMatchUps, tournamentRecord, drawDefinition, drawPositions, matchUpsMap, structure, event, }) {
|
|
15761
|
-
const assignments = structure.structures?.reduce((assignments, structure) => {
|
|
15762
|
-
const structureAssignments = structure?.positionAssignments.filter((assignment) => drawPositions?.includes(assignment.drawPosition));
|
|
15763
|
-
if (structureAssignments)
|
|
15764
|
-
assignments.push(...structureAssignments);
|
|
15765
|
-
return assignments;
|
|
15766
|
-
}, []);
|
|
15767
|
-
if (assignments.filter(({ bye }) => bye).length === 2)
|
|
15768
|
-
return { ...SUCCESS };
|
|
15769
|
-
if (assignments.filter(({ qualifier }) => qualifier).length === 2)
|
|
15770
|
-
return { ...SUCCESS };
|
|
15771
|
-
resetLineUps({
|
|
15772
|
-
inContextDrawMatchUps,
|
|
15773
|
-
tournamentRecord,
|
|
15774
|
-
drawDefinition,
|
|
15775
|
-
matchUpsMap,
|
|
15776
|
-
assignments,
|
|
15777
|
-
structure,
|
|
15778
|
-
event,
|
|
15779
|
-
});
|
|
15780
|
-
const isQualifierSwap = assignments.some(({ qualifier }) => qualifier);
|
|
15781
|
-
const isByeSwap = assignments.some(({ bye }) => bye);
|
|
15782
|
-
if (isByeSwap && !isQualifierSwap) {
|
|
15783
|
-
swapParticipantIdWithBYE({
|
|
15784
|
-
inContextDrawMatchUps,
|
|
15785
|
-
tournamentRecord,
|
|
15786
|
-
drawDefinition,
|
|
15787
|
-
assignments,
|
|
15788
|
-
matchUpsMap,
|
|
15789
|
-
structure,
|
|
15790
|
-
event,
|
|
15791
|
-
});
|
|
15792
|
-
}
|
|
15793
|
-
else {
|
|
15794
|
-
const originalAssignments = makeDeepCopy(assignments, false, true);
|
|
15795
|
-
assignments.forEach((assignment, index) => {
|
|
15796
|
-
const newParticipantId = originalAssignments[1 - index].participantId;
|
|
15797
|
-
assignment.qualifier = originalAssignments[1 - index].qualifier;
|
|
15798
|
-
assignment.participantId = newParticipantId;
|
|
15799
|
-
});
|
|
15800
|
-
}
|
|
15801
|
-
return { ...SUCCESS };
|
|
15802
|
-
}
|
|
15803
|
-
|
|
15804
|
-
function swapDrawPositionAssignments(params) {
|
|
15805
|
-
return swapDrawPositionAssignments$1(params);
|
|
15806
|
-
}
|
|
15807
|
-
|
|
15808
15566
|
function modifySeedAssignment({ validation = true, tournamentRecord, drawDefinition, participantId, structureId, seedValue, event, }) {
|
|
15809
15567
|
if (!drawDefinition)
|
|
15810
15568
|
return { error: MISSING_DRAW_DEFINITION };
|
|
@@ -17893,8 +17651,14 @@ function renameStructures({ drawDefinition, structureDetails }) {
|
|
|
17893
17651
|
}
|
|
17894
17652
|
for (const structure of drawDefinition.structures || []) {
|
|
17895
17653
|
const structureName = detailMap[structure.structureId];
|
|
17896
|
-
if (structureName)
|
|
17654
|
+
if (structureName)
|
|
17897
17655
|
structure.structureName = structureName;
|
|
17656
|
+
if (structure.structures) {
|
|
17657
|
+
for (const subStructure of structure.structures) {
|
|
17658
|
+
const subStructureName = detailMap[subStructure.structureId];
|
|
17659
|
+
if (subStructureName)
|
|
17660
|
+
subStructure.structureName = subStructureName;
|
|
17661
|
+
}
|
|
17898
17662
|
}
|
|
17899
17663
|
}
|
|
17900
17664
|
return { ...SUCCESS };
|
|
@@ -18156,6 +17920,289 @@ function addVoluntaryConsolationStage(params) {
|
|
|
18156
17920
|
return addVoluntaryConsolationStage$1(params);
|
|
18157
17921
|
}
|
|
18158
17922
|
|
|
17923
|
+
const QUALIFYING_PARTICIPANT_METHOD = 'qualifierDrawPositionAssignment';
|
|
17924
|
+
const WITHDRAW_PARTICIPANT_METHOD = 'withdrawParticipantAtDrawPosition';
|
|
17925
|
+
const ALTERNATE_PARTICIPANT_METHOD = 'alternateDrawPositionAssignment';
|
|
17926
|
+
const LUCKY_PARTICIPANT_METHOD = 'luckyLoserDrawPositionAssignment';
|
|
17927
|
+
const REMOVE_ASSIGNMENT_METHOD = 'removeDrawPositionAssignment';
|
|
17928
|
+
const SWAP_PARTICIPANT_METHOD = 'swapDrawPositionAssignments';
|
|
17929
|
+
const MODIFY_PAIR_ASSIGNMENT_METHOD = 'modifyPairAssignment';
|
|
17930
|
+
const SWAP_ADHOC_PARTICIPANT_METHOD = 'adHocPositionSwap';
|
|
17931
|
+
const ADD_NICKNAME_METHOD = 'modifyParticipantOtherName';
|
|
17932
|
+
const ASSIGN_PARTICIPANT_METHOD = 'assignDrawPosition';
|
|
17933
|
+
const REMOVE_SEED_METHOD = 'removeSeededParticipant';
|
|
17934
|
+
const ASSIGN_BYE_METHOD = 'assignDrawPositionBye';
|
|
17935
|
+
const SEED_VALUE_METHOD = 'modifySeedAssignment';
|
|
17936
|
+
const ADD_PENALTY_METHOD = 'addPenalty';
|
|
17937
|
+
const MODIFY_PAIR_ASSIGNMENT = 'MODIFY_PAIR';
|
|
17938
|
+
const QUALIFYING_PARTICIPANT = 'QUALIFIER';
|
|
17939
|
+
const ALTERNATE_PARTICIPANT = 'ALTERNATE';
|
|
17940
|
+
const WITHDRAW_PARTICIPANT = 'WITHDRAW';
|
|
17941
|
+
const ASSIGN_PARTICIPANT = 'ASSIGN';
|
|
17942
|
+
const REMOVE_ASSIGNMENT = 'REMOVE';
|
|
17943
|
+
const LUCKY_PARTICIPANT = 'LUCKY';
|
|
17944
|
+
const REMOVE_SEED = 'REMOVE_SEED';
|
|
17945
|
+
const SWAP_PARTICIPANTS = 'SWAP';
|
|
17946
|
+
const ADD_NICKNAME = 'NICKNAME';
|
|
17947
|
+
const SEED_VALUE = 'SEED_VALUE';
|
|
17948
|
+
const ADD_PENALTY = 'PENALTY';
|
|
17949
|
+
const ASSIGN_BYE = 'BYE';
|
|
17950
|
+
const positionActionConstants = {
|
|
17951
|
+
MODIFY_PAIR_ASSIGNMENT,
|
|
17952
|
+
QUALIFYING_PARTICIPANT,
|
|
17953
|
+
ALTERNATE_PARTICIPANT,
|
|
17954
|
+
WITHDRAW_PARTICIPANT,
|
|
17955
|
+
ASSIGN_PARTICIPANT,
|
|
17956
|
+
LUCKY_PARTICIPANT,
|
|
17957
|
+
REMOVE_ASSIGNMENT,
|
|
17958
|
+
SWAP_PARTICIPANTS,
|
|
17959
|
+
ADD_NICKNAME,
|
|
17960
|
+
REMOVE_SEED,
|
|
17961
|
+
ADD_PENALTY,
|
|
17962
|
+
ASSIGN_BYE,
|
|
17963
|
+
SEED_VALUE,
|
|
17964
|
+
};
|
|
17965
|
+
|
|
17966
|
+
function swapDrawPositionAssignments({ tournamentRecord, drawDefinition, drawPositions, structureId, event }) {
|
|
17967
|
+
if (!drawDefinition)
|
|
17968
|
+
return { error: MISSING_DRAW_DEFINITION };
|
|
17969
|
+
if (!structureId)
|
|
17970
|
+
return { error: MISSING_STRUCTURE_ID };
|
|
17971
|
+
if (drawPositions?.length !== 2)
|
|
17972
|
+
return { error: INVALID_VALUES, drawPositions };
|
|
17973
|
+
const matchUpsMap = getMatchUpsMap({ drawDefinition });
|
|
17974
|
+
const { matchUps: inContextDrawMatchUps } = getAllDrawMatchUps({
|
|
17975
|
+
inContext: true,
|
|
17976
|
+
drawDefinition,
|
|
17977
|
+
matchUpsMap,
|
|
17978
|
+
});
|
|
17979
|
+
const { structure } = findStructure({ drawDefinition, structureId });
|
|
17980
|
+
if (!structure)
|
|
17981
|
+
return { error: STRUCTURE_NOT_FOUND };
|
|
17982
|
+
const appliedPolicies = getAppliedPolicies({
|
|
17983
|
+
tournamentRecord,
|
|
17984
|
+
drawDefinition,
|
|
17985
|
+
event,
|
|
17986
|
+
}).appliedPolicies ?? {};
|
|
17987
|
+
let result;
|
|
17988
|
+
if (structure.structureType === CONTAINER) {
|
|
17989
|
+
result = roundRobinSwap({
|
|
17990
|
+
inContextDrawMatchUps,
|
|
17991
|
+
tournamentRecord,
|
|
17992
|
+
drawDefinition,
|
|
17993
|
+
drawPositions,
|
|
17994
|
+
matchUpsMap,
|
|
17995
|
+
structure,
|
|
17996
|
+
event,
|
|
17997
|
+
});
|
|
17998
|
+
}
|
|
17999
|
+
else {
|
|
18000
|
+
result = eliminationSwap({
|
|
18001
|
+
inContextDrawMatchUps,
|
|
18002
|
+
tournamentRecord,
|
|
18003
|
+
drawDefinition,
|
|
18004
|
+
drawPositions,
|
|
18005
|
+
matchUpsMap,
|
|
18006
|
+
structure,
|
|
18007
|
+
event,
|
|
18008
|
+
});
|
|
18009
|
+
}
|
|
18010
|
+
if (result.error)
|
|
18011
|
+
return result;
|
|
18012
|
+
conditionallyDisableLinkPositioning({ structure, drawPositions });
|
|
18013
|
+
const positionAction = {
|
|
18014
|
+
name: SWAP_PARTICIPANT_METHOD,
|
|
18015
|
+
drawPositions,
|
|
18016
|
+
structureId,
|
|
18017
|
+
};
|
|
18018
|
+
addPositionActionTelemetry({ appliedPolicies, drawDefinition, positionAction });
|
|
18019
|
+
modifyPositionAssignmentsNotice({
|
|
18020
|
+
tournamentId: tournamentRecord?.tournamentId,
|
|
18021
|
+
drawDefinition,
|
|
18022
|
+
structure,
|
|
18023
|
+
event,
|
|
18024
|
+
});
|
|
18025
|
+
if (event.eventType === TEAM_EVENT) {
|
|
18026
|
+
const inContextTargetMatchUps = getAllStructureMatchUps({
|
|
18027
|
+
matchUpFilters: { matchUpTypes: [TEAM_MATCHUP] },
|
|
18028
|
+
inContext: true,
|
|
18029
|
+
structure,
|
|
18030
|
+
}).matchUps.filter((matchUp) => matchUp.drawPositions?.some((drawPosition) => drawPositions.includes(drawPosition)));
|
|
18031
|
+
const structureMatchUps = getAllStructureMatchUps({
|
|
18032
|
+
matchUpFilters: { matchUpTypes: [TEAM_MATCHUP] },
|
|
18033
|
+
structure,
|
|
18034
|
+
}).matchUps;
|
|
18035
|
+
inContextTargetMatchUps.forEach((inContextTargetMatchUp) => {
|
|
18036
|
+
(inContextTargetMatchUp.sides || []).forEach((inContextSide) => {
|
|
18037
|
+
const drawPosition = inContextSide?.drawPosition;
|
|
18038
|
+
if (drawPositions.includes(drawPosition)) {
|
|
18039
|
+
const teamParticipantId = inContextSide.participantId;
|
|
18040
|
+
const matchUp = structureMatchUps.find(({ matchUpId }) => matchUpId === inContextTargetMatchUp.matchUpId);
|
|
18041
|
+
const drawPositionSideIndex = inContextTargetMatchUp?.sides?.reduce((index, side, i) => (side.drawPosition === drawPosition ? i : index), undefined);
|
|
18042
|
+
updateSideLineUp({
|
|
18043
|
+
inContextTargetMatchUp,
|
|
18044
|
+
drawPositionSideIndex,
|
|
18045
|
+
teamParticipantId,
|
|
18046
|
+
tournamentRecord,
|
|
18047
|
+
drawDefinition,
|
|
18048
|
+
matchUp,
|
|
18049
|
+
event,
|
|
18050
|
+
});
|
|
18051
|
+
}
|
|
18052
|
+
});
|
|
18053
|
+
});
|
|
18054
|
+
}
|
|
18055
|
+
modifyDrawNotice({ drawDefinition, structureIds: [structureId] });
|
|
18056
|
+
return { ...SUCCESS };
|
|
18057
|
+
}
|
|
18058
|
+
function eliminationSwap({ inContextDrawMatchUps, tournamentRecord, drawDefinition, drawPositions, matchUpsMap, structure, event, }) {
|
|
18059
|
+
const assignments = structure?.positionAssignments.filter((assignment) => drawPositions?.includes(assignment.drawPosition));
|
|
18060
|
+
if (!assignments) {
|
|
18061
|
+
return {
|
|
18062
|
+
error: INVALID_VALUES,
|
|
18063
|
+
structure,
|
|
18064
|
+
info: 'Missing positionAssignments',
|
|
18065
|
+
};
|
|
18066
|
+
}
|
|
18067
|
+
if (assignments.filter(({ bye }) => bye).length === 2)
|
|
18068
|
+
return { ...SUCCESS };
|
|
18069
|
+
if (assignments.filter(({ qualifier }) => qualifier).length === 2)
|
|
18070
|
+
return { ...SUCCESS };
|
|
18071
|
+
const isQualifierSwap = assignments.some(({ qualifier }) => qualifier);
|
|
18072
|
+
const isByeSwap = assignments.some(({ bye }) => bye);
|
|
18073
|
+
if (isByeSwap && !isQualifierSwap) {
|
|
18074
|
+
return swapParticipantIdWithBYE({
|
|
18075
|
+
inContextDrawMatchUps,
|
|
18076
|
+
tournamentRecord,
|
|
18077
|
+
drawDefinition,
|
|
18078
|
+
assignments,
|
|
18079
|
+
matchUpsMap,
|
|
18080
|
+
structure,
|
|
18081
|
+
event,
|
|
18082
|
+
});
|
|
18083
|
+
}
|
|
18084
|
+
else {
|
|
18085
|
+
return eliminationPosiitonSwap({
|
|
18086
|
+
inContextDrawMatchUps,
|
|
18087
|
+
tournamentRecord,
|
|
18088
|
+
drawDefinition,
|
|
18089
|
+
assignments,
|
|
18090
|
+
matchUpsMap,
|
|
18091
|
+
structure,
|
|
18092
|
+
event,
|
|
18093
|
+
});
|
|
18094
|
+
}
|
|
18095
|
+
}
|
|
18096
|
+
function swapParticipantIdWithBYE({ inContextDrawMatchUps, tournamentRecord, drawDefinition, assignments, matchUpsMap, structure, event, }) {
|
|
18097
|
+
const originalByeAssignment = assignments.find(({ bye }) => bye);
|
|
18098
|
+
const originalParticipantIdAssignment = assignments.find(({ participantId }) => participantId);
|
|
18099
|
+
const originalByeDrawPosition = originalByeAssignment.drawPosition;
|
|
18100
|
+
const { participantId, drawPosition: originalParticipantIdDrawPosition } = originalParticipantIdAssignment;
|
|
18101
|
+
const { structureId } = structure;
|
|
18102
|
+
let result = removeDrawPositionAssignment({
|
|
18103
|
+
drawPosition: originalByeDrawPosition,
|
|
18104
|
+
inContextDrawMatchUps,
|
|
18105
|
+
tournamentRecord,
|
|
18106
|
+
drawDefinition,
|
|
18107
|
+
structureId,
|
|
18108
|
+
matchUpsMap,
|
|
18109
|
+
});
|
|
18110
|
+
if (result.error)
|
|
18111
|
+
return result;
|
|
18112
|
+
result = removeDrawPositionAssignment({
|
|
18113
|
+
drawPosition: originalParticipantIdDrawPosition,
|
|
18114
|
+
inContextDrawMatchUps,
|
|
18115
|
+
tournamentRecord,
|
|
18116
|
+
drawDefinition,
|
|
18117
|
+
structureId,
|
|
18118
|
+
matchUpsMap,
|
|
18119
|
+
});
|
|
18120
|
+
if (result.error)
|
|
18121
|
+
return result;
|
|
18122
|
+
assignDrawPositionBye({
|
|
18123
|
+
drawPosition: originalParticipantIdDrawPosition,
|
|
18124
|
+
tournamentRecord,
|
|
18125
|
+
drawDefinition,
|
|
18126
|
+
structureId,
|
|
18127
|
+
matchUpsMap,
|
|
18128
|
+
event,
|
|
18129
|
+
});
|
|
18130
|
+
result = assignDrawPosition$1({
|
|
18131
|
+
drawPosition: originalByeDrawPosition,
|
|
18132
|
+
inContextDrawMatchUps,
|
|
18133
|
+
tournamentRecord,
|
|
18134
|
+
drawDefinition,
|
|
18135
|
+
structureId,
|
|
18136
|
+
participantId,
|
|
18137
|
+
matchUpsMap,
|
|
18138
|
+
event,
|
|
18139
|
+
});
|
|
18140
|
+
if (result.error)
|
|
18141
|
+
return result;
|
|
18142
|
+
return { ...SUCCESS };
|
|
18143
|
+
}
|
|
18144
|
+
function eliminationPosiitonSwap({ inContextDrawMatchUps, tournamentRecord, drawDefinition, assignments, matchUpsMap, structure, event, }) {
|
|
18145
|
+
const newAssignments = Object.assign({}, ...assignments.map((assignment, index) => {
|
|
18146
|
+
const { drawPosition } = assignment;
|
|
18147
|
+
const newAssignment = { ...assignments[1 - index], drawPosition };
|
|
18148
|
+
return { [drawPosition]: newAssignment };
|
|
18149
|
+
}));
|
|
18150
|
+
structure.positionAssignments = structure.positionAssignments.map((assignment) => newAssignments[assignment.drawPosition] || assignment);
|
|
18151
|
+
resetLineUps({
|
|
18152
|
+
inContextDrawMatchUps,
|
|
18153
|
+
tournamentRecord,
|
|
18154
|
+
drawDefinition,
|
|
18155
|
+
matchUpsMap,
|
|
18156
|
+
assignments,
|
|
18157
|
+
structure,
|
|
18158
|
+
event,
|
|
18159
|
+
});
|
|
18160
|
+
return { ...SUCCESS };
|
|
18161
|
+
}
|
|
18162
|
+
function roundRobinSwap({ inContextDrawMatchUps, tournamentRecord, drawDefinition, drawPositions, matchUpsMap, structure, event, }) {
|
|
18163
|
+
const assignments = structure.structures?.reduce((assignments, structure) => {
|
|
18164
|
+
const structureAssignments = structure?.positionAssignments.filter((assignment) => drawPositions?.includes(assignment.drawPosition));
|
|
18165
|
+
if (structureAssignments)
|
|
18166
|
+
assignments.push(...structureAssignments);
|
|
18167
|
+
return assignments;
|
|
18168
|
+
}, []);
|
|
18169
|
+
if (assignments.filter(({ bye }) => bye).length === 2)
|
|
18170
|
+
return { ...SUCCESS };
|
|
18171
|
+
if (assignments.filter(({ qualifier }) => qualifier).length === 2)
|
|
18172
|
+
return { ...SUCCESS };
|
|
18173
|
+
resetLineUps({
|
|
18174
|
+
inContextDrawMatchUps,
|
|
18175
|
+
tournamentRecord,
|
|
18176
|
+
drawDefinition,
|
|
18177
|
+
matchUpsMap,
|
|
18178
|
+
assignments,
|
|
18179
|
+
structure,
|
|
18180
|
+
event,
|
|
18181
|
+
});
|
|
18182
|
+
const isQualifierSwap = assignments.some(({ qualifier }) => qualifier);
|
|
18183
|
+
const isByeSwap = assignments.some(({ bye }) => bye);
|
|
18184
|
+
if (isByeSwap && !isQualifierSwap) {
|
|
18185
|
+
swapParticipantIdWithBYE({
|
|
18186
|
+
inContextDrawMatchUps,
|
|
18187
|
+
tournamentRecord,
|
|
18188
|
+
drawDefinition,
|
|
18189
|
+
assignments,
|
|
18190
|
+
matchUpsMap,
|
|
18191
|
+
structure,
|
|
18192
|
+
event,
|
|
18193
|
+
});
|
|
18194
|
+
}
|
|
18195
|
+
else {
|
|
18196
|
+
const originalAssignments = makeDeepCopy(assignments, false, true);
|
|
18197
|
+
assignments.forEach((assignment, index) => {
|
|
18198
|
+
const newParticipantId = originalAssignments[1 - index].participantId;
|
|
18199
|
+
assignment.qualifier = originalAssignments[1 - index].qualifier;
|
|
18200
|
+
assignment.participantId = newParticipantId;
|
|
18201
|
+
});
|
|
18202
|
+
}
|
|
18203
|
+
return { ...SUCCESS };
|
|
18204
|
+
}
|
|
18205
|
+
|
|
18159
18206
|
function removeSeededParticipant({ tournamentRecord, drawDefinition, participantId, structureId, }) {
|
|
18160
18207
|
const stack = 'removeSeededParticipant';
|
|
18161
18208
|
if (!tournamentRecord)
|
|
@@ -18476,6 +18523,50 @@ function addQualifying(params) {
|
|
|
18476
18523
|
});
|
|
18477
18524
|
}
|
|
18478
18525
|
|
|
18526
|
+
function adHocPositionSwap(params) {
|
|
18527
|
+
const paramsCheck = checkRequiredParameters(params, [
|
|
18528
|
+
{ [DRAW_DEFINITION]: true, [STRUCTURE_ID]: true, [MATCHUP_ID]: true },
|
|
18529
|
+
{ [ROUND_NUMBER]: true, [VALIDATE]: (value) => Number.isInteger(value) && value > 0 },
|
|
18530
|
+
{
|
|
18531
|
+
[VALIDATE]: (value) => Array.isArray(value) && value.length === 2 && value.every(isString),
|
|
18532
|
+
[INVALID]: INVALID_PARTICIPANT_IDS,
|
|
18533
|
+
participantIds: true,
|
|
18534
|
+
},
|
|
18535
|
+
]);
|
|
18536
|
+
if (paramsCheck.error)
|
|
18537
|
+
return paramsCheck;
|
|
18538
|
+
const { drawDefinition, structureId, tournamentRecord, event } = params;
|
|
18539
|
+
const { structure } = findStructure({ drawDefinition, structureId });
|
|
18540
|
+
if (!structure)
|
|
18541
|
+
return { error: STRUCTURE_NOT_FOUND };
|
|
18542
|
+
if (!isAdHoc({ structure }))
|
|
18543
|
+
return { error: INVALID_STRUCTURE };
|
|
18544
|
+
const hasParticipant = (matchUp) => matchUp.sides?.map((side) => side.participantId).some((id) => params.participantIds.includes(id));
|
|
18545
|
+
const targetRoundNumber = (matchUp) => matchUp.roundNumber === params.roundNumber;
|
|
18546
|
+
const noScoreValue = (matchUp) => !checkScoreHasValue(matchUp);
|
|
18547
|
+
const targetMatchUps = (structure?.matchUps ?? [])
|
|
18548
|
+
.filter(targetRoundNumber)
|
|
18549
|
+
.filter(noScoreValue)
|
|
18550
|
+
.filter(hasParticipant);
|
|
18551
|
+
if (targetMatchUps.length !== 2)
|
|
18552
|
+
return { error: INVALID_PARTICIPANT_IDS };
|
|
18553
|
+
for (const matchUp of targetMatchUps) {
|
|
18554
|
+
const side = matchUp?.sides?.find((side) => params.participantIds.includes(side?.participantId));
|
|
18555
|
+
if (side) {
|
|
18556
|
+
const swappedParticipantId = params.participantIds.find((id) => id !== side?.participantId);
|
|
18557
|
+
side.participantId = swappedParticipantId;
|
|
18558
|
+
modifyMatchUpNotice({
|
|
18559
|
+
tournamentId: tournamentRecord?.tournamentId,
|
|
18560
|
+
eventId: event?.eventId,
|
|
18561
|
+
drawDefinition,
|
|
18562
|
+
matchUp,
|
|
18563
|
+
});
|
|
18564
|
+
}
|
|
18565
|
+
}
|
|
18566
|
+
modifyDrawNotice({ drawDefinition, structureIds: [structureId] });
|
|
18567
|
+
return { ...SUCCESS };
|
|
18568
|
+
}
|
|
18569
|
+
|
|
18479
18570
|
function buildFeedRound({ includeMatchUpType, drawPosition, roundNumber, matchUpType, idPrefix, matchUps, isMock, uuids, nodes, fed, }) {
|
|
18480
18571
|
const feedRoundMatchUpsCount = nodes.length;
|
|
18481
18572
|
const initialGroupDrawPosition = drawPosition ? drawPosition - feedRoundMatchUpsCount : undefined;
|
|
@@ -20067,8 +20158,8 @@ function calculatePercentages({ participantResults, matchUpFormat, tallyPolicy,
|
|
|
20067
20158
|
let gamesPct = Math.round((gamesWon / gamesTotal) * 1000) / 1000;
|
|
20068
20159
|
if (gamesPct === Infinity || isNaN(gamesPct))
|
|
20069
20160
|
gamesPct = 0;
|
|
20070
|
-
|
|
20071
|
-
|
|
20161
|
+
const pointsTotal = participantResults[participantId].pointsWon + participantResults[participantId].pointsLost;
|
|
20162
|
+
let pointsPct = Math.round((participantResults[participantId].pointsWon / pointsTotal) * 1000) / 1000;
|
|
20072
20163
|
if (pointsPct === Infinity || isNaN(pointsPct))
|
|
20073
20164
|
pointsPct = 0;
|
|
20074
20165
|
participantResults[participantId].setsWon = setsWon;
|
|
@@ -23630,6 +23721,7 @@ function setSubOrder({ tournamentRecord, drawDefinition, drawPosition, structure
|
|
|
23630
23721
|
|
|
23631
23722
|
var mutate$c = {
|
|
23632
23723
|
__proto__: null,
|
|
23724
|
+
adHocPositionSwap: adHocPositionSwap,
|
|
23633
23725
|
addAdHocMatchUps: addAdHocMatchUps,
|
|
23634
23726
|
addDrawDefinitionTimeItem: addDrawDefinitionTimeItem,
|
|
23635
23727
|
addPlayoffStructures: addPlayoffStructures,
|
|
@@ -23961,48 +24053,6 @@ function getSourceStructureIdsAndRelevantLinks({ targetRoundNumber, finishingPos
|
|
|
23961
24053
|
return { sourceStructureIds, relevantLinks };
|
|
23962
24054
|
}
|
|
23963
24055
|
|
|
23964
|
-
const QUALIFYING_PARTICIPANT_METHOD = 'qualifierDrawPositionAssignment';
|
|
23965
|
-
const WITHDRAW_PARTICIPANT_METHOD = 'withdrawParticipantAtDrawPosition';
|
|
23966
|
-
const ALTERNATE_PARTICIPANT_METHOD = 'alternateDrawPositionAssignment';
|
|
23967
|
-
const LUCKY_PARTICIPANT_METHOD = 'luckyLoserDrawPositionAssignment';
|
|
23968
|
-
const REMOVE_ASSIGNMENT_METHOD = 'removeDrawPositionAssignment';
|
|
23969
|
-
const SWAP_PARTICIPANT_METHOD = 'swapDrawPositionAssignments';
|
|
23970
|
-
const MODIFY_PAIR_ASSIGNMENT_METHOD = 'modifyPairAssignment';
|
|
23971
|
-
const ADD_NICKNAME_METHOD = 'modifyParticipantOtherName';
|
|
23972
|
-
const ASSIGN_PARTICIPANT_METHOD = 'assignDrawPosition';
|
|
23973
|
-
const REMOVE_SEED_METHOD = 'removeSeededParticipant';
|
|
23974
|
-
const ASSIGN_BYE_METHOD = 'assignDrawPositionBye';
|
|
23975
|
-
const SEED_VALUE_METHOD = 'modifySeedAssignment';
|
|
23976
|
-
const ADD_PENALTY_METHOD = 'addPenalty';
|
|
23977
|
-
const MODIFY_PAIR_ASSIGNMENT = 'MODIFY_PAIR';
|
|
23978
|
-
const QUALIFYING_PARTICIPANT = 'QUALIFIER';
|
|
23979
|
-
const ALTERNATE_PARTICIPANT = 'ALTERNATE';
|
|
23980
|
-
const WITHDRAW_PARTICIPANT = 'WITHDRAW';
|
|
23981
|
-
const ASSIGN_PARTICIPANT = 'ASSIGN';
|
|
23982
|
-
const REMOVE_ASSIGNMENT = 'REMOVE';
|
|
23983
|
-
const LUCKY_PARTICIPANT = 'LUCKY';
|
|
23984
|
-
const REMOVE_SEED = 'REMOVE_SEED';
|
|
23985
|
-
const SWAP_PARTICIPANTS = 'SWAP';
|
|
23986
|
-
const ADD_NICKNAME = 'NICKNAME';
|
|
23987
|
-
const SEED_VALUE = 'SEED_VALUE';
|
|
23988
|
-
const ADD_PENALTY = 'PENALTY';
|
|
23989
|
-
const ASSIGN_BYE = 'BYE';
|
|
23990
|
-
const positionActionConstants = {
|
|
23991
|
-
MODIFY_PAIR_ASSIGNMENT,
|
|
23992
|
-
QUALIFYING_PARTICIPANT,
|
|
23993
|
-
ALTERNATE_PARTICIPANT,
|
|
23994
|
-
WITHDRAW_PARTICIPANT,
|
|
23995
|
-
ASSIGN_PARTICIPANT,
|
|
23996
|
-
LUCKY_PARTICIPANT,
|
|
23997
|
-
REMOVE_ASSIGNMENT,
|
|
23998
|
-
SWAP_PARTICIPANTS,
|
|
23999
|
-
ADD_NICKNAME,
|
|
24000
|
-
REMOVE_SEED,
|
|
24001
|
-
ADD_PENALTY,
|
|
24002
|
-
ASSIGN_BYE,
|
|
24003
|
-
SEED_VALUE,
|
|
24004
|
-
};
|
|
24005
|
-
|
|
24006
24056
|
function getValidModifyAssignedPairAction({ tournamentParticipants, returnParticipants, drawPosition, participant, drawId, event, }) {
|
|
24007
24057
|
const availableIndividualParticipantIds = event?.entries
|
|
24008
24058
|
?.filter(({ entryStatus }) => [UNGROUPED, UNPAIRED].includes(entryStatus))
|
|
@@ -24422,7 +24472,10 @@ function getEventAlternateParticipantIds({ eventEntries, structure }) {
|
|
|
24422
24472
|
|
|
24423
24473
|
function adHocMatchUpActions({ restrictAdHocRoundParticipants, tournamentParticipants, matchUpParticipantIds, otherFlightEntries, drawDefinition, structureId, sideNumber, matchUpId, structure, matchUp, drawId, event, }) {
|
|
24424
24474
|
const validActions = [];
|
|
24425
|
-
const
|
|
24475
|
+
const matchUps = structure?.matchUps ?? [];
|
|
24476
|
+
const side = matchUp.sides?.find((side) => side.sideNumber === sideNumber);
|
|
24477
|
+
const sideParticipantId = side?.participantId;
|
|
24478
|
+
const roundMatchUps = matchUps.filter(({ roundNumber }) => roundNumber === matchUp.roundNumber);
|
|
24426
24479
|
const enteredParticipantIds = drawDefinition?.entries
|
|
24427
24480
|
?.filter(({ entryStatus }) => entryStatus && DIRECT_ENTRY_STATUSES.includes(entryStatus))
|
|
24428
24481
|
.map(getParticipantId) ?? [];
|
|
@@ -24483,13 +24536,46 @@ function adHocMatchUpActions({ restrictAdHocRoundParticipants, tournamentPartici
|
|
|
24483
24536
|
type: ALTERNATE,
|
|
24484
24537
|
});
|
|
24485
24538
|
}
|
|
24486
|
-
if (!checkScoreHasValue(matchUp) && sideNumber) {
|
|
24487
|
-
|
|
24488
|
-
|
|
24539
|
+
if (!checkScoreHasValue(matchUp) && sideNumber && sideParticipantId) {
|
|
24540
|
+
validActions.push({
|
|
24541
|
+
payload: { drawId, matchUpId, structureId, sideNumber },
|
|
24542
|
+
method: REMOVE_SIDE_METHOD,
|
|
24543
|
+
type: REMOVE_PARTICIPANT,
|
|
24544
|
+
});
|
|
24545
|
+
const getMatchUpPairing = (matchUp) => matchUp.sides.map(getParticipantId);
|
|
24546
|
+
const notThisMatchUp = ({ matchUpId }) => matchUpId !== matchUp.matchUpId;
|
|
24547
|
+
const noScoreValue = (matchUp) => !checkScoreHasValue(matchUp);
|
|
24548
|
+
const opponentParticipantId = matchUp.sides?.find((side) => side.sideNumber !== sideNumber)?.participantId;
|
|
24549
|
+
const otherRoundMatchUps = matchUps.filter(({ roundNumber }) => roundNumber !== matchUp.roundNumber);
|
|
24550
|
+
const otherRoundParticipantPairings = otherRoundMatchUps.filter(notThisMatchUp).map(getMatchUpPairing);
|
|
24551
|
+
const otherOpponents = [
|
|
24552
|
+
opponentParticipantId,
|
|
24553
|
+
...otherRoundParticipantPairings.filter((pairing) => pairing.includes(sideParticipantId)).flat(),
|
|
24554
|
+
].filter(Boolean);
|
|
24555
|
+
const notPreviousOpponent = (id) => !otherOpponents.flat().includes(id);
|
|
24556
|
+
const availableSwaps = roundMatchUps
|
|
24557
|
+
.filter(noScoreValue)
|
|
24558
|
+
.filter(notThisMatchUp)
|
|
24559
|
+
.map(getMatchUpPairing)
|
|
24560
|
+
.flat()
|
|
24561
|
+
.filter(notPreviousOpponent);
|
|
24562
|
+
if (availableSwaps.length) {
|
|
24563
|
+
const swappableParticipants = tournamentParticipants
|
|
24564
|
+
?.filter((participant) => availableSwaps.includes(participant.participantId))
|
|
24565
|
+
.map((participant) => makeDeepCopy(participant, undefined, true));
|
|
24489
24566
|
validActions.push({
|
|
24490
|
-
payload: {
|
|
24491
|
-
|
|
24492
|
-
|
|
24567
|
+
payload: {
|
|
24568
|
+
participantIds: [sideParticipantId],
|
|
24569
|
+
roundNumber: matchUp.roundNumber,
|
|
24570
|
+
structureId,
|
|
24571
|
+
sideNumber,
|
|
24572
|
+
matchUpId,
|
|
24573
|
+
drawId,
|
|
24574
|
+
},
|
|
24575
|
+
swappableParticipantIds: availableSwaps,
|
|
24576
|
+
method: SWAP_ADHOC_PARTICIPANT_METHOD,
|
|
24577
|
+
type: SWAP_PARTICIPANTS,
|
|
24578
|
+
swappableParticipants,
|
|
24493
24579
|
});
|
|
24494
24580
|
}
|
|
24495
24581
|
}
|
|
@@ -25595,6 +25681,7 @@ var query$b = {
|
|
|
25595
25681
|
getAvailablePlayoffProfiles: getAvailablePlayoffProfiles,
|
|
25596
25682
|
getDrawDefinitionTimeItem: getDrawDefinitionTimeItem,
|
|
25597
25683
|
getDrawParticipantRepresentativeIds: getDrawParticipantRepresentativeIds,
|
|
25684
|
+
getDrawStructures: getDrawStructures,
|
|
25598
25685
|
getDrawTypeCoercion: getDrawTypeCoercion,
|
|
25599
25686
|
getEligibleVoluntaryConsolationParticipants: getEligibleVoluntaryConsolationParticipants,
|
|
25600
25687
|
getMatchUpsMap: getMatchUpsMap,
|
|
@@ -34182,6 +34269,13 @@ function getDrawIsPublished({ publishStatus, drawId }) {
|
|
|
34182
34269
|
return true;
|
|
34183
34270
|
}
|
|
34184
34271
|
|
|
34272
|
+
const PUBLIC_DISPLAY = 'PUBLIC';
|
|
34273
|
+
const ADMIN_DISPLAY = 'ADMIN';
|
|
34274
|
+
const displayConstants = {
|
|
34275
|
+
PUBLIC_DISPLAY,
|
|
34276
|
+
ADMIN_DISPLAY,
|
|
34277
|
+
};
|
|
34278
|
+
|
|
34185
34279
|
function getDrawData(params) {
|
|
34186
34280
|
const { tournamentParticipants = [], includePositionAssignments, policyDefinitions, tournamentRecord, inContext = true, usePublishState, status = PUBLIC, pressureRating, refreshResults, drawDefinition, noDeepCopy, sortConfig, context, event, } = params;
|
|
34187
34281
|
if (!drawDefinition)
|
|
@@ -34289,7 +34383,8 @@ function getDrawData(params) {
|
|
|
34289
34383
|
stage,
|
|
34290
34384
|
}))(structure)
|
|
34291
34385
|
: {};
|
|
34292
|
-
|
|
34386
|
+
const displaySettings = findExtension({ element: structure, name: DISPLAY }).extension?.value;
|
|
34387
|
+
structureInfo.display = displaySettings?.[PUBLIC_DISPLAY] ?? displaySettings;
|
|
34293
34388
|
structureInfo.sourceStructureIds = sourceStructureIds[structureId];
|
|
34294
34389
|
structureInfo.hasDrawFeedProfile = hasDrawFeedProfile[structureId];
|
|
34295
34390
|
structureInfo.positionAssignments = positionAssignments;
|
|
@@ -35561,7 +35656,7 @@ function participantScheduledMatchUps({ scheduleAttributes = ['scheduledDate', '
|
|
|
35561
35656
|
.reduce((dateMatchUps, matchUp) => {
|
|
35562
35657
|
const { schedule } = matchUp;
|
|
35563
35658
|
const date = extractDate(schedule?.scheduledDate);
|
|
35564
|
-
const time = extractTime(schedule?.scheduledTime);
|
|
35659
|
+
const time = extractTime$1(schedule?.scheduledTime);
|
|
35565
35660
|
if (date && time) {
|
|
35566
35661
|
if (dateMatchUps[date]) {
|
|
35567
35662
|
dateMatchUps[date].push(matchUp);
|
|
@@ -35574,7 +35669,7 @@ function participantScheduledMatchUps({ scheduleAttributes = ['scheduledDate', '
|
|
|
35574
35669
|
}, {});
|
|
35575
35670
|
const dates = Object.keys(scheduledMatchUps);
|
|
35576
35671
|
dates.forEach((date) => {
|
|
35577
|
-
scheduledMatchUps[date].sort((a, b) => timeSort(extractTime(a.schedule?.scheduledTime), extractTime(b.schedule?.scheduledTime)));
|
|
35672
|
+
scheduledMatchUps[date].sort((a, b) => timeSort(extractTime$1(a.schedule?.scheduledTime), extractTime$1(b.schedule?.scheduledTime)));
|
|
35578
35673
|
});
|
|
35579
35674
|
return { ...SUCCESS, scheduledMatchUps };
|
|
35580
35675
|
}
|
|
@@ -35630,7 +35725,7 @@ function scheduledSortedMatchUps({ schedulingProfile, matchUps = [] }) {
|
|
|
35630
35725
|
const timeGroups = { noScheduledTime: [] };
|
|
35631
35726
|
for (const matchUp of dateGroup) {
|
|
35632
35727
|
const schedule = matchUp.schedule || {};
|
|
35633
|
-
const scheduledTime = (schedule.scheduledTime && extractTime(schedule.scheduledTime)) || 'noScheduledTime';
|
|
35728
|
+
const scheduledTime = (schedule.scheduledTime && extractTime$1(schedule.scheduledTime)) || 'noScheduledTime';
|
|
35634
35729
|
if (!timeGroups[scheduledTime])
|
|
35635
35730
|
timeGroups[scheduledTime] = [];
|
|
35636
35731
|
timeGroups[scheduledTime].push(matchUp);
|
|
@@ -37167,6 +37262,7 @@ var index$f = {
|
|
|
37167
37262
|
getDrawData: getDrawData,
|
|
37168
37263
|
getDrawDefinitionTimeItem: getDrawDefinitionTimeItem,
|
|
37169
37264
|
getDrawParticipantRepresentativeIds: getDrawParticipantRepresentativeIds,
|
|
37265
|
+
getDrawStructures: getDrawStructures,
|
|
37170
37266
|
getDrawTypeCoercion: getDrawTypeCoercion,
|
|
37171
37267
|
getEligibleVoluntaryConsolationParticipants: getEligibleVoluntaryConsolationParticipants,
|
|
37172
37268
|
getEntriesAndSeedsCount: getEntriesAndSeedsCount,
|
|
@@ -37504,6 +37600,7 @@ function autoSeeding({ tournamentRecord, drawDefinition, policyDefinitions, scal
|
|
|
37504
37600
|
|
|
37505
37601
|
var index$e = {
|
|
37506
37602
|
__proto__: null,
|
|
37603
|
+
adHocPositionSwap: adHocPositionSwap,
|
|
37507
37604
|
addAdHocMatchUps: addAdHocMatchUps,
|
|
37508
37605
|
addDrawDefinitionTimeItem: addDrawDefinitionTimeItem,
|
|
37509
37606
|
addFinishingRounds: addFinishingRounds,
|
|
@@ -37541,6 +37638,7 @@ var index$e = {
|
|
|
37541
37638
|
getAvailablePlayoffProfiles: getAvailablePlayoffProfiles,
|
|
37542
37639
|
getDrawDefinitionTimeItem: getDrawDefinitionTimeItem,
|
|
37543
37640
|
getDrawParticipantRepresentativeIds: getDrawParticipantRepresentativeIds,
|
|
37641
|
+
getDrawStructures: getDrawStructures,
|
|
37544
37642
|
getDrawTypeCoercion: getDrawTypeCoercion,
|
|
37545
37643
|
getEligibleVoluntaryConsolationParticipants: getEligibleVoluntaryConsolationParticipants,
|
|
37546
37644
|
getMatchUpsMap: getMatchUpsMap,
|
|
@@ -37983,11 +38081,11 @@ function addParticipants({ allowDuplicateParticipantIdPairs, returnParticipants,
|
|
|
37983
38081
|
}
|
|
37984
38082
|
}
|
|
37985
38083
|
|
|
37986
|
-
function addEventEntryPairs(
|
|
37987
|
-
|
|
37988
|
-
|
|
37989
|
-
|
|
37990
|
-
|
|
38084
|
+
function addEventEntryPairs(params) {
|
|
38085
|
+
const paramsCheck = checkRequiredParameters(params, [{ [TOURNAMENT_RECORD]: true, [EVENT]: true }]);
|
|
38086
|
+
if (paramsCheck.error)
|
|
38087
|
+
return paramsCheck;
|
|
38088
|
+
const { allowDuplicateParticipantIdPairs, entryStatus = ALTERNATE, participantIdPairs = [], entryStage = MAIN, tournamentRecord, drawDefinition, event, uuids, } = params;
|
|
37991
38089
|
if (event.eventType !== DOUBLES)
|
|
37992
38090
|
return { error: INVALID_EVENT_TYPE };
|
|
37993
38091
|
const existingParticipantIdPairs = [];
|
|
@@ -38004,10 +38102,10 @@ function addEventEntryPairs({ allowDuplicateParticipantIdPairs, entryStage = MAI
|
|
|
38004
38102
|
const invalidParticipantIdPairs = participantIdPairs.filter((pair) => {
|
|
38005
38103
|
if (pair.length !== 2)
|
|
38006
38104
|
return true;
|
|
38007
|
-
if (!genderMap.has(pair[0]) || !genderMap.has(pair[1]))
|
|
38008
|
-
return true;
|
|
38009
38105
|
if (!event.gender || event.gender === ANY)
|
|
38010
38106
|
return false;
|
|
38107
|
+
if (!genderMap.has(pair[0]) || !genderMap.has(pair[1]))
|
|
38108
|
+
return true;
|
|
38011
38109
|
const participantGenders = pair.map((id) => genderMap.get(id));
|
|
38012
38110
|
let invalidParticiapntGenders = (event.gender === MALE && (participantGenders[0] !== MALE || participantGenders[1] !== MALE)) ||
|
|
38013
38111
|
(event.gender === FEMALE && (participantGenders[0] !== FEMALE || participantGenders[1] !== FEMALE));
|
|
@@ -40028,7 +40126,7 @@ function generateTimeSlots(params) {
|
|
|
40028
40126
|
.sort((a, b) => tidyTime(a.startTime).localeCompare(tidyTime(b.startTime)))
|
|
40029
40127
|
.forEach((booking) => {
|
|
40030
40128
|
const timeSlot = {
|
|
40031
|
-
startTime: extractTime(startTime.toISOString()),
|
|
40129
|
+
startTime: extractTime$1(startTime.toISOString()),
|
|
40032
40130
|
endTime: booking.startTime,
|
|
40033
40131
|
};
|
|
40034
40132
|
if (timeToDate(booking.startTime) > startTime) {
|
|
@@ -40039,7 +40137,7 @@ function generateTimeSlots(params) {
|
|
|
40039
40137
|
}
|
|
40040
40138
|
});
|
|
40041
40139
|
const timeSlot = {
|
|
40042
|
-
startTime: extractTime(startTime.toISOString()),
|
|
40140
|
+
startTime: extractTime$1(startTime.toISOString()),
|
|
40043
40141
|
endTime: courtDate.endTime,
|
|
40044
40142
|
};
|
|
40045
40143
|
if (timeToDate(courtDate.endTime) > startTime) {
|
|
@@ -40157,7 +40255,7 @@ function generateVirtualCourts(params) {
|
|
|
40157
40255
|
},
|
|
40158
40256
|
};
|
|
40159
40257
|
});
|
|
40160
|
-
unassignedBookings.sort((a, b) => timeStringMinutes(a.startTime) - timeStringMinutes(b.startTime));
|
|
40258
|
+
unassignedBookings.sort((a, b) => timeStringMinutes$1(a.startTime) - timeStringMinutes$1(b.startTime));
|
|
40161
40259
|
const getCourtTimeSlots = () => inProcessCourts
|
|
40162
40260
|
.map((court) => {
|
|
40163
40261
|
const courtDate = court.dateAvailability;
|
|
@@ -40172,15 +40270,15 @@ function generateVirtualCourts(params) {
|
|
|
40172
40270
|
const assignedBookings = [];
|
|
40173
40271
|
for (const unassignedBooking of unassignedBookings) {
|
|
40174
40272
|
const { startTime, endTime, averageMinutes, recoveryMinutes, matchUpId } = unassignedBooking;
|
|
40175
|
-
const startMinutes = timeStringMinutes(startTime);
|
|
40176
|
-
const endMinutes = timeStringMinutes(endTime);
|
|
40273
|
+
const startMinutes = timeStringMinutes$1(startTime);
|
|
40274
|
+
const endMinutes = timeStringMinutes$1(endTime);
|
|
40177
40275
|
const courtTimeSlots = getCourtTimeSlots();
|
|
40178
40276
|
const bestCourt = courtTimeSlots.reduce((best, { courtId, courtName, timeSlots }) => {
|
|
40179
40277
|
let startDifference;
|
|
40180
40278
|
const timeSlot = timeSlots.find(({ startTime, endTime }) => {
|
|
40181
|
-
startDifference = timeStringMinutes(startTime) - startMinutes;
|
|
40182
|
-
const startFits = startMinutes >= timeStringMinutes(startTime);
|
|
40183
|
-
const endFits = endMinutes <= timeStringMinutes(endTime);
|
|
40279
|
+
startDifference = timeStringMinutes$1(startTime) - startMinutes;
|
|
40280
|
+
const startFits = startMinutes >= timeStringMinutes$1(startTime);
|
|
40281
|
+
const endFits = endMinutes <= timeStringMinutes$1(endTime);
|
|
40184
40282
|
return (endFits &&
|
|
40185
40283
|
best.startDifference !== 0 &&
|
|
40186
40284
|
(((startDifference === 0 || startDifference + periodLength >= 0) &&
|
|
@@ -40235,8 +40333,8 @@ function getDateTimeBoundary({ scheduleDate, startTime, endTime, courts }) {
|
|
|
40235
40333
|
const comparisonTime = accessor && (dateAvailability?.[accessor] || court[accessor]);
|
|
40236
40334
|
return comparisonTime &&
|
|
40237
40335
|
(!boundaryTime ||
|
|
40238
|
-
(startTime && timeStringMinutes(comparisonTime) < timeStringMinutes(boundaryTime)) ||
|
|
40239
|
-
(endTime && timeStringMinutes(comparisonTime) > timeStringMinutes(boundaryTime)))
|
|
40336
|
+
(startTime && timeStringMinutes$1(comparisonTime) < timeStringMinutes$1(boundaryTime)) ||
|
|
40337
|
+
(endTime && timeStringMinutes$1(comparisonTime) > timeStringMinutes$1(boundaryTime)))
|
|
40240
40338
|
? comparisonTime
|
|
40241
40339
|
: boundaryTime;
|
|
40242
40340
|
}, undefined);
|
|
@@ -40264,7 +40362,7 @@ function getFirstTimeSlotStartTime({ averageMinutes, startTime, endTime, courts,
|
|
|
40264
40362
|
const timeSlotMinutes = minutesDifference(timeSlotStartTime, timeSlotEndTime);
|
|
40265
40363
|
const available = timeSlotMinutes >= averageMinutes;
|
|
40266
40364
|
if (available) {
|
|
40267
|
-
const timeString = extractTime(timeSlotStartTime.toISOString());
|
|
40365
|
+
const timeString = extractTime$1(timeSlotStartTime.toISOString());
|
|
40268
40366
|
if (!firstTimeSlotStartTime || timeString < firstTimeSlotStartTime) {
|
|
40269
40367
|
firstTimeSlotStartTime = timeString;
|
|
40270
40368
|
}
|
|
@@ -40284,8 +40382,8 @@ function getScheduleTimes(params) {
|
|
|
40284
40382
|
const { calculateStartTimeFromCourts = true, remainingScheduleTimes, averageMatchUpMinutes, clearScheduleDates, courtsCount, bookings, } = params;
|
|
40285
40383
|
periodLength = periodLength || calculatePeriodLength({ averageMatchUpMinutes });
|
|
40286
40384
|
date = extractDate(date);
|
|
40287
|
-
startTime = extractTime(startTime);
|
|
40288
|
-
endTime = extractTime(endTime);
|
|
40385
|
+
startTime = extractTime$1(startTime);
|
|
40386
|
+
endTime = extractTime$1(endTime);
|
|
40289
40387
|
let previousCalculation = 0;
|
|
40290
40388
|
let previousAvailableCourts = 0;
|
|
40291
40389
|
let cumulativeMatches = 0;
|
|
@@ -40312,8 +40410,8 @@ function getScheduleTimes(params) {
|
|
|
40312
40410
|
if (calculateStartTimeFromCourts && firstTimeSlotStartTime) {
|
|
40313
40411
|
startTime = firstTimeSlotStartTime ? firstTimeSlotStartTime : startTime;
|
|
40314
40412
|
}
|
|
40315
|
-
const dayStartMinutes = timeStringMinutes(startTime);
|
|
40316
|
-
const dayEndMinutes = timeStringMinutes(endTime);
|
|
40413
|
+
const dayStartMinutes = timeStringMinutes$1(startTime);
|
|
40414
|
+
const dayEndMinutes = timeStringMinutes$1(endTime);
|
|
40317
40415
|
const dayMinutes = dayEndMinutes - dayStartMinutes;
|
|
40318
40416
|
const periodCount = Math.floor(dayMinutes / periodLength);
|
|
40319
40417
|
const periods = generateRange(0, periodCount + 1);
|
|
@@ -43144,7 +43242,7 @@ function assignMatchUpCourt({ removePriorValues, tournamentRecords, tournamentRe
|
|
|
43144
43242
|
}
|
|
43145
43243
|
|
|
43146
43244
|
function timeDate(value, scheduledDate) {
|
|
43147
|
-
const time = validTimeString.test(value) ? value : extractTime(value);
|
|
43245
|
+
const time = validTimeString.test(value) ? value : extractTime$1(value);
|
|
43148
43246
|
const date = extractDate(value) || extractDate(scheduledDate) || formatDate(new Date());
|
|
43149
43247
|
return new Date(`${date}T${time}`).getTime();
|
|
43150
43248
|
}
|
|
@@ -45154,13 +45252,13 @@ function addParticipantPotentialRecovery({ individualParticipantProfiles, recove
|
|
|
45154
45252
|
}
|
|
45155
45253
|
|
|
45156
45254
|
function updateTimeAfterRecovery({ matchUpPotentialParticipantIds, individualParticipantProfiles, typeChangeRecoveryMinutes, averageMatchUpMinutes = 0, matchUpNotBeforeTimes, matchUpDependencies, recoveryMinutes = 0, scheduleTime, matchUp, }) {
|
|
45157
|
-
const endTime = extractTime(matchUp?.schedule?.endTime);
|
|
45255
|
+
const endTime = extractTime$1(matchUp?.schedule?.endTime);
|
|
45158
45256
|
const timeAfterRecovery = endTime
|
|
45159
45257
|
? addMinutesToTimeString(endTime, ensureInt(recoveryMinutes))
|
|
45160
45258
|
: addMinutesToTimeString(scheduleTime, ensureInt(averageMatchUpMinutes) + ensureInt(recoveryMinutes));
|
|
45161
45259
|
const typeChangeTimeAfterRecovery = typeChangeRecoveryMinutes &&
|
|
45162
45260
|
(endTime
|
|
45163
|
-
? addMinutesToTimeString(extractTime(endTime), typeChangeRecoveryMinutes)
|
|
45261
|
+
? addMinutesToTimeString(extractTime$1(endTime), typeChangeRecoveryMinutes)
|
|
45164
45262
|
: addMinutesToTimeString(scheduleTime, ensureInt(averageMatchUpMinutes) + ensureInt(typeChangeRecoveryMinutes)));
|
|
45165
45263
|
const participantIdDependencies = matchUpDependencies?.[matchUp.matchUpId]?.participantIds || [];
|
|
45166
45264
|
const potentialIndividualParticipantIds = ((matchUp.roundPosition && matchUpPotentialParticipantIds[matchUp.matchUpId]) ||
|
|
@@ -45215,12 +45313,12 @@ function checkDependendantTiming({ matchUpScheduleTimes, matchUpDependencies, sc
|
|
|
45215
45313
|
};
|
|
45216
45314
|
if (candidateScheduleTime && !dependent.matchUpId)
|
|
45217
45315
|
return candidateDependent;
|
|
45218
|
-
return timeStringMinutes(candidateScheduleTime) < timeStringMinutes(dependent.scheduleTime)
|
|
45316
|
+
return timeStringMinutes$1(candidateScheduleTime) < timeStringMinutes$1(dependent.scheduleTime)
|
|
45219
45317
|
? candidateDependent
|
|
45220
45318
|
: dependent;
|
|
45221
45319
|
}, {});
|
|
45222
45320
|
if (earliestDependent.scheduleTime &&
|
|
45223
|
-
timeStringMinutes(dependentNotBeforeTime) > timeStringMinutes(earliestDependent.scheduleTime)) {
|
|
45321
|
+
timeStringMinutes$1(dependentNotBeforeTime) > timeStringMinutes$1(earliestDependent.scheduleTime)) {
|
|
45224
45322
|
scheduledDependent = earliestDependent;
|
|
45225
45323
|
}
|
|
45226
45324
|
}
|
|
@@ -45256,8 +45354,8 @@ function checkRequestConflicts({ averageMatchUpMinutes = 90, requestConflicts =
|
|
|
45256
45354
|
.filter((request) => request.requestType === DO_NOT_SCHEDULE && sameDay(scheduleDate, request.date));
|
|
45257
45355
|
const conflicts = [];
|
|
45258
45356
|
const matchUpId = matchUp?.matchUpId;
|
|
45259
|
-
const scheduleStart = timeToDate(extractTime(scheduleTime), extractDate(scheduleDate));
|
|
45260
|
-
const averageEnd = extractTime(addMinutes(scheduleStart, averageMatchUpMinutes).toISOString());
|
|
45357
|
+
const scheduleStart = timeToDate(extractTime$1(scheduleTime), extractDate(scheduleDate));
|
|
45358
|
+
const averageEnd = extractTime$1(addMinutes(scheduleStart, averageMatchUpMinutes).toISOString());
|
|
45261
45359
|
for (const request of relevantPersonRequests) {
|
|
45262
45360
|
const { requestId, startTime, endTime } = request;
|
|
45263
45361
|
const conflict = (scheduleTime > startTime && scheduleTime < endTime) || (averageEnd > startTime && averageEnd < endTime);
|
|
@@ -45450,7 +45548,7 @@ function generateBookings({ defaultRecoveryMinutes = 0, averageMatchUpMinutes =
|
|
|
45450
45548
|
eventType,
|
|
45451
45549
|
});
|
|
45452
45550
|
const { courtId, venueId } = schedule;
|
|
45453
|
-
const startTime = extractTime(schedule.scheduledTime);
|
|
45551
|
+
const startTime = extractTime$1(schedule.scheduledTime);
|
|
45454
45552
|
const endTime = addMinutesToTimeString(startTime, averageMinutes);
|
|
45455
45553
|
return {
|
|
45456
45554
|
recoveryMinutes,
|
|
@@ -45645,10 +45743,10 @@ function getVenueSchedulingDetails({ matchUpPotentialParticipantIds, individualP
|
|
|
45645
45743
|
}
|
|
45646
45744
|
|
|
45647
45745
|
function analyzeScheduleOverlap(a, b) {
|
|
45648
|
-
const startA = timeStringMinutes(a.scheduleTime);
|
|
45649
|
-
const endA = timeStringMinutes(a.timeAfterRecovery);
|
|
45650
|
-
const startB = timeStringMinutes(b.scheduleTime);
|
|
45651
|
-
const endB = timeStringMinutes(b.timeAfterRecovery);
|
|
45746
|
+
const startA = timeStringMinutes$1(a.scheduleTime);
|
|
45747
|
+
const endA = timeStringMinutes$1(a.timeAfterRecovery);
|
|
45748
|
+
const startB = timeStringMinutes$1(b.scheduleTime);
|
|
45749
|
+
const endB = timeStringMinutes$1(b.timeAfterRecovery);
|
|
45652
45750
|
const startOrEndEquivalence = startA === startB || endA === endB;
|
|
45653
45751
|
const startAisContained = startA > startB && startA < endB;
|
|
45654
45752
|
const startBisContained = startB > startA && startB < endA;
|
|
@@ -45676,7 +45774,7 @@ function checkRecoveryTime({ individualParticipantProfiles, matchUpNotBeforeTime
|
|
|
45676
45774
|
const profile = individualParticipantProfiles[participantId];
|
|
45677
45775
|
if (!profile.timeAfterRecovery)
|
|
45678
45776
|
return true;
|
|
45679
|
-
const endTime = extractTime(matchUp?.schedule?.endTime);
|
|
45777
|
+
const endTime = extractTime$1(matchUp?.schedule?.endTime);
|
|
45680
45778
|
const timeAfterRecovery = endTime
|
|
45681
45779
|
? addMinutesToTimeString(endTime, ensureInt(recoveryMinutes))
|
|
45682
45780
|
: addMinutesToTimeString(scheduleTime, ensureInt(averageMatchUpMinutes) + ensureInt(recoveryMinutes));
|
|
@@ -46109,7 +46207,7 @@ function jinnScheduler({ schedulingProfileModifications, checkPotentialRequestCo
|
|
|
46109
46207
|
}
|
|
46110
46208
|
});
|
|
46111
46209
|
noTimeMatchUpIds[scheduleDate] = venueScheduledRoundDetails[venueId].matchUpsToSchedule.map(getMatchUpId);
|
|
46112
|
-
scheduleTimesRemaining[scheduleDate][venueId] = venueScheduledRoundDetails[venueId].scheduleTimes.sort((a, b) => timeStringMinutes(a.scheduleTime) - timeStringMinutes(b.scheduleTime));
|
|
46210
|
+
scheduleTimesRemaining[scheduleDate][venueId] = venueScheduledRoundDetails[venueId].scheduleTimes.sort((a, b) => timeStringMinutes$1(a.scheduleTime) - timeStringMinutes$1(b.scheduleTime));
|
|
46113
46211
|
}
|
|
46114
46212
|
if (!dryRun && allDateScheduledByeMatchUpDetails?.length) {
|
|
46115
46213
|
bulkScheduleMatchUps({
|
|
@@ -46199,7 +46297,7 @@ function getEarliestCourtTime({ averageMinutes, startTime, endTime, court, date
|
|
|
46199
46297
|
const timeSlotMinutes = minutesDifference(consideredStartTime, timeSlotEndTime);
|
|
46200
46298
|
const available = timeSlotMinutes >= averageMinutes;
|
|
46201
46299
|
if (available) {
|
|
46202
|
-
const timeString = extractTime(consideredStartTime.toISOString());
|
|
46300
|
+
const timeString = extractTime$1(consideredStartTime.toISOString());
|
|
46203
46301
|
if (!first || timeString < first)
|
|
46204
46302
|
first = timeString;
|
|
46205
46303
|
}
|
|
@@ -46352,7 +46450,7 @@ function v2Scheduler({ schedulingProfileModifications, checkPotentialRequestConf
|
|
|
46352
46450
|
court,
|
|
46353
46451
|
});
|
|
46354
46452
|
if (courtTime.scheduleTime &&
|
|
46355
|
-
timeStringMinutes(scheduleTime) >= timeStringMinutes(courtTime.scheduleTime)) {
|
|
46453
|
+
timeStringMinutes$1(scheduleTime) >= timeStringMinutes$1(courtTime.scheduleTime)) {
|
|
46356
46454
|
return courtTime;
|
|
46357
46455
|
}
|
|
46358
46456
|
const { scheduledDependent } = checkDependendantTiming({
|
|
@@ -46407,7 +46505,7 @@ function v2Scheduler({ schedulingProfileModifications, checkPotentialRequestConf
|
|
|
46407
46505
|
matchUp,
|
|
46408
46506
|
});
|
|
46409
46507
|
if (!courtTime.scheduleTime ||
|
|
46410
|
-
timeStringMinutes(scheduleTime) < timeStringMinutes(courtTime.scheduleTime)) {
|
|
46508
|
+
timeStringMinutes$1(scheduleTime) < timeStringMinutes$1(courtTime.scheduleTime)) {
|
|
46411
46509
|
courtTime.averageMatchUpMinutes = averageMatchUpMinutes;
|
|
46412
46510
|
courtTime.recoveryMinutes = recoveryMinutes;
|
|
46413
46511
|
courtTime.scheduleTime = scheduleTime;
|
|
@@ -49604,11 +49702,11 @@ function addCourt({ tournamentRecord, disableNotice, venueId, courtId, court })
|
|
|
49604
49702
|
const dateAvailability = (court?.dateAvailability || []).map((availabilty) => ({
|
|
49605
49703
|
...availabilty,
|
|
49606
49704
|
date: extractDate(availabilty.date),
|
|
49607
|
-
startTime: extractTime(availabilty.startTime),
|
|
49608
|
-
endTime: extractTime(availabilty.endTime),
|
|
49705
|
+
startTime: extractTime$1(availabilty.startTime),
|
|
49706
|
+
endTime: extractTime$1(availabilty.endTime),
|
|
49609
49707
|
bookings: availabilty.bookings?.map(({ startTime, endTime, bookingType }) => ({
|
|
49610
|
-
startTime: extractTime(startTime),
|
|
49611
|
-
endTime: extractTime(endTime),
|
|
49708
|
+
startTime: extractTime$1(startTime),
|
|
49709
|
+
endTime: extractTime$1(endTime),
|
|
49612
49710
|
bookingType,
|
|
49613
49711
|
})),
|
|
49614
49712
|
}));
|
|
@@ -50544,8 +50642,8 @@ function mergePersonRequests({ personRequests, personId, requests }) {
|
|
|
50544
50642
|
let { date, startTime, endTime } = request;
|
|
50545
50643
|
if (request.requestType === DO_NOT_SCHEDULE) {
|
|
50546
50644
|
date = extractDate(date);
|
|
50547
|
-
startTime = extractTime(startTime);
|
|
50548
|
-
endTime = extractTime(endTime);
|
|
50645
|
+
startTime = extractTime$1(startTime);
|
|
50646
|
+
endTime = extractTime$1(endTime);
|
|
50549
50647
|
if (date && startTime && endTime) {
|
|
50550
50648
|
return { date, startTime, endTime, requestType: request.requestType };
|
|
50551
50649
|
}
|
|
@@ -52528,7 +52626,7 @@ function getVenueReport(dates, venue, matchUps) {
|
|
|
52528
52626
|
const timeSlots = courtDate && generateTimeSlots({ courtDate }).timeSlots;
|
|
52529
52627
|
const courtAvailableMinutes = timeSlots?.reduce((minutes, timeSlot) => {
|
|
52530
52628
|
const { startTime, endTime } = timeSlot;
|
|
52531
|
-
const timeSlotMinutes = timeStringMinutes(endTime) - timeStringMinutes(startTime);
|
|
52629
|
+
const timeSlotMinutes = timeStringMinutes$1(endTime) - timeStringMinutes$1(startTime);
|
|
52532
52630
|
return minutes + timeSlotMinutes;
|
|
52533
52631
|
}, 0);
|
|
52534
52632
|
if (courtAvailableMinutes)
|
|
@@ -52537,9 +52635,9 @@ function getVenueReport(dates, venue, matchUps) {
|
|
|
52537
52635
|
}
|
|
52538
52636
|
const venueMatchUps = matchUps.filter(({ schedule }) => schedule.venueId === venueId && sameDay(date, schedule.scheduledDate));
|
|
52539
52637
|
venueMatchUps.forEach(({ schedule }) => {
|
|
52540
|
-
const startTime = extractTime(schedule.scheduledTime);
|
|
52638
|
+
const startTime = extractTime$1(schedule.scheduledTime);
|
|
52541
52639
|
const endTime = addMinutesToTimeString(startTime, schedule.averageMinutes);
|
|
52542
|
-
const matchUpScheduledMinutes = timeStringMinutes(endTime) - timeStringMinutes(startTime);
|
|
52640
|
+
const matchUpScheduledMinutes = timeStringMinutes$1(endTime) - timeStringMinutes$1(startTime);
|
|
52543
52641
|
scheduledMinutes += matchUpScheduledMinutes;
|
|
52544
52642
|
});
|
|
52545
52643
|
const percentUtilization = availableMinutes ? ((scheduledMinutes / availableMinutes) * 100).toFixed(2) : '100';
|
|
@@ -52586,7 +52684,7 @@ function calculateScheduleTimes({ calculateStartTimeFromCourts = true, defaultRe
|
|
|
52586
52684
|
const dateAvailability = court.dateAvailability?.find((availability) => !availability.date || sameDay(scheduleDate, availability.date));
|
|
52587
52685
|
const comparisonStartTime = dateAvailability?.startTime ?? court.startTime;
|
|
52588
52686
|
return comparisonStartTime &&
|
|
52589
|
-
(!minStartTime || timeStringMinutes(comparisonStartTime) < timeStringMinutes(minStartTime))
|
|
52687
|
+
(!minStartTime || timeStringMinutes$1(comparisonStartTime) < timeStringMinutes$1(minStartTime))
|
|
52590
52688
|
? comparisonStartTime
|
|
52591
52689
|
: minStartTime;
|
|
52592
52690
|
}, undefined);
|
|
@@ -52595,7 +52693,7 @@ function calculateScheduleTimes({ calculateStartTimeFromCourts = true, defaultRe
|
|
|
52595
52693
|
endTime = courts?.reduce((maxEndTime, court) => {
|
|
52596
52694
|
const dateAvailability = court.dateAvailability?.find((availability) => !availability.date || sameDay(scheduleDate, availability.date));
|
|
52597
52695
|
const comparisonEndTime = dateAvailability?.endTime ?? court.endTime;
|
|
52598
|
-
return comparisonEndTime && (!maxEndTime || timeStringMinutes(comparisonEndTime) > timeStringMinutes(maxEndTime))
|
|
52696
|
+
return comparisonEndTime && (!maxEndTime || timeStringMinutes$1(comparisonEndTime) > timeStringMinutes$1(maxEndTime))
|
|
52599
52697
|
? comparisonEndTime
|
|
52600
52698
|
: maxEndTime;
|
|
52601
52699
|
}, undefined);
|
|
@@ -52640,7 +52738,7 @@ function calculateScheduleTimes({ calculateStartTimeFromCourts = true, defaultRe
|
|
|
52640
52738
|
timingDetails,
|
|
52641
52739
|
});
|
|
52642
52740
|
const { courtId, venueId } = schedule;
|
|
52643
|
-
const startTime = extractTime(schedule.scheduledTime);
|
|
52741
|
+
const startTime = extractTime$1(schedule.scheduledTime);
|
|
52644
52742
|
const endTime = addMinutesToTimeString(startTime, averageMinutes);
|
|
52645
52743
|
return {
|
|
52646
52744
|
recoveryMinutes,
|
|
@@ -52928,8 +53026,8 @@ function scheduleMatchUps(params) {
|
|
|
52928
53026
|
const { venueId, scheduleTimes, dateScheduledMatchUpIds } = calculateScheduleTimes({
|
|
52929
53027
|
tournamentRecords,
|
|
52930
53028
|
remainingScheduleTimes,
|
|
52931
|
-
startTime: extractTime(startTime),
|
|
52932
|
-
endTime: extractTime(endTime),
|
|
53029
|
+
startTime: extractTime$1(startTime),
|
|
53030
|
+
endTime: extractTime$1(endTime),
|
|
52933
53031
|
scheduleDate: extractDate(scheduleDate),
|
|
52934
53032
|
averageMatchUpMinutes,
|
|
52935
53033
|
clearScheduleDates,
|
|
@@ -53447,7 +53545,7 @@ function bulkReschedule({ tournamentRecord, scheduleChange, matchUpIds, dryRun }
|
|
|
53447
53545
|
}
|
|
53448
53546
|
if (minutesChange && scheduledTime) {
|
|
53449
53547
|
const scheduledTimeDate = extractDate(scheduledTime);
|
|
53450
|
-
const currentDayMinutes = timeStringMinutes(extractTime(scheduledTime));
|
|
53548
|
+
const currentDayMinutes = timeStringMinutes$1(extractTime$1(scheduledTime));
|
|
53451
53549
|
const newTime = currentDayMinutes + minutesChange;
|
|
53452
53550
|
doNotReschedule = newTime < 0 || newTime > dayTotalMinutes;
|
|
53453
53551
|
if (!doNotReschedule) {
|
|
@@ -55647,11 +55745,11 @@ function updateCourtAvailability({ tournamentRecord }) {
|
|
|
55647
55745
|
}
|
|
55648
55746
|
for (const court of courts) {
|
|
55649
55747
|
const { startTime, endTime } = (court.dateAvailability ?? []).reduce((extents, availability) => {
|
|
55650
|
-
const startMinutes = timeStringMinutes(extents.startTime);
|
|
55651
|
-
const endMinutes = timeStringMinutes(extents.endTime);
|
|
55652
|
-
if (availability.startTime && timeStringMinutes(availability.startTime) < startMinutes)
|
|
55748
|
+
const startMinutes = timeStringMinutes$1(extents.startTime);
|
|
55749
|
+
const endMinutes = timeStringMinutes$1(extents.endTime);
|
|
55750
|
+
if (availability.startTime && timeStringMinutes$1(availability.startTime) < startMinutes)
|
|
55653
55751
|
extents.startTime = availability.startTime;
|
|
55654
|
-
if (availability.endTime && timeStringMinutes(availability.endTime) > endMinutes)
|
|
55752
|
+
if (availability.endTime && timeStringMinutes$1(availability.endTime) > endMinutes)
|
|
55655
55753
|
extents.endTime = availability.endTime;
|
|
55656
55754
|
return extents;
|
|
55657
55755
|
}, { startTime: '08:00', endTime: '18:00' });
|
|
@@ -56593,7 +56691,7 @@ function visualizeScheduledMatchUps({ scheduledMatchUps, showGlobalLog }) {
|
|
|
56593
56691
|
},
|
|
56594
56692
|
}, true);
|
|
56595
56693
|
roundMatchUps[roundNumber].forEach(({ matchUpId, schedule }) => {
|
|
56596
|
-
const scheduledTime = extractTime(schedule.scheduledTime);
|
|
56694
|
+
const scheduledTime = extractTime$1(schedule.scheduledTime);
|
|
56597
56695
|
pushGlobalLog({
|
|
56598
56696
|
matchUpId,
|
|
56599
56697
|
time: scheduledTime,
|
|
@@ -56613,6 +56711,31 @@ function visualizeScheduledMatchUps({ scheduledMatchUps, showGlobalLog }) {
|
|
|
56613
56711
|
printGlobalLog();
|
|
56614
56712
|
}
|
|
56615
56713
|
|
|
56714
|
+
const { extractTime, timeStringMinutes } = dateTime;
|
|
56715
|
+
function matchUpScheduleSort(a, b) {
|
|
56716
|
+
const scheduleA = a.schedule ?? {};
|
|
56717
|
+
const scheduleB = b.schedule ?? {};
|
|
56718
|
+
if (scheduleA.scheduledDate && !scheduleB.scheduledDate)
|
|
56719
|
+
return 1;
|
|
56720
|
+
if (scheduleB.scheduledDate && !scheduleA.scheduledDate)
|
|
56721
|
+
return -1;
|
|
56722
|
+
if (scheduleA.scheduledDate && scheduleB.scheduledDate) {
|
|
56723
|
+
if (scheduleA.scheduledDate === scheduleB.scheduledDate) {
|
|
56724
|
+
if (scheduleA.scheduledTime && !scheduleB.scheduledTime)
|
|
56725
|
+
return 1;
|
|
56726
|
+
if (scheduleB.scheduledTime && !scheduleA.scheduledTime)
|
|
56727
|
+
return -1;
|
|
56728
|
+
if (scheduleA.scheduledTime && scheduleB.scheduledTime) {
|
|
56729
|
+
const timeA = timeStringMinutes(extractTime(scheduleA.scheduledTime));
|
|
56730
|
+
const timeB = timeStringMinutes(extractTime(scheduleB.scheduledTime));
|
|
56731
|
+
return timeA - timeB;
|
|
56732
|
+
}
|
|
56733
|
+
}
|
|
56734
|
+
return new Date(scheduleA.scheduledDate).getTime() - new Date(scheduleB.scheduledDate).getTime();
|
|
56735
|
+
}
|
|
56736
|
+
return 0;
|
|
56737
|
+
}
|
|
56738
|
+
|
|
56616
56739
|
function dehydrateMatchUps({ tournamentRecord }) {
|
|
56617
56740
|
if (!tournamentRecord)
|
|
56618
56741
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
@@ -56833,6 +56956,7 @@ var index$1 = {
|
|
|
56833
56956
|
isOdd: isOdd,
|
|
56834
56957
|
isPowerOf2: isPowerOf2,
|
|
56835
56958
|
makeDeepCopy: makeDeepCopy,
|
|
56959
|
+
matchUpScheduleSort: matchUpScheduleSort,
|
|
56836
56960
|
matchUpSort: matchUpSort,
|
|
56837
56961
|
nearestPowerOf2: nearestPowerOf2,
|
|
56838
56962
|
nextPowerOf2: nextPowerOf2,
|
|
@@ -58453,6 +58577,7 @@ var index = {
|
|
|
58453
58577
|
auditConstants: auditConstants,
|
|
58454
58578
|
completedMatchUpStatuses: completedMatchUpStatuses,
|
|
58455
58579
|
directingMatchUpStatuses: directingMatchUpStatuses,
|
|
58580
|
+
displayConstants: displayConstants,
|
|
58456
58581
|
drawDefinitionConstants: drawDefinitionConstants,
|
|
58457
58582
|
entryStatusConstants: entryStatusConstants,
|
|
58458
58583
|
errorConditionConstants: errorConditionConstants,
|
|
@@ -58498,6 +58623,7 @@ exports.competitionEngine = competitionEngine;
|
|
|
58498
58623
|
exports.competitionGovernor = index$h;
|
|
58499
58624
|
exports.completedMatchUpStatuses = completedMatchUpStatuses;
|
|
58500
58625
|
exports.directingMatchUpStatuses = directingMatchUpStatuses;
|
|
58626
|
+
exports.displayConstants = displayConstants;
|
|
58501
58627
|
exports.drawDefinitionConstants = drawDefinitionConstants;
|
|
58502
58628
|
exports.drawsGovernor = index$e;
|
|
58503
58629
|
exports.entriesGovernor = index$d;
|