tods-competition-factory 2.0.31 → 2.0.33
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 +6 -6
- package/dist/tods-competition-factory.d.ts +103 -357
- package/dist/tods-competition-factory.development.cjs.js +497 -301
- 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 +11 -11
|
@@ -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.33';
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
function isFunction(obj) {
|
|
@@ -2704,7 +2704,6 @@ function findExtension({ discover, element, name, ...params }) {
|
|
|
2704
2704
|
|
|
2705
2705
|
const ACTIVE_SUSPENSION = 'activeSuspension';
|
|
2706
2706
|
const APPLIED_POLICIES = 'appliedPolicies';
|
|
2707
|
-
const AUDIT_POSITION_ACTIONS = 'positionActions';
|
|
2708
2707
|
const CONTEXT = 'context';
|
|
2709
2708
|
const DELEGATED_OUTCOME = 'delegatedOutcome';
|
|
2710
2709
|
const DISABLED = 'disabled';
|
|
@@ -2723,6 +2722,7 @@ const LINKED_TOURNAMENTS = 'linkedTournamentsIds';
|
|
|
2723
2722
|
const MATCHUP_HISTORY = 'matchUpHistory';
|
|
2724
2723
|
const PARTICIPANT_REPRESENTATIVES = 'participantRepresentatives';
|
|
2725
2724
|
const PERSON_REQUESTS = 'personRequests';
|
|
2725
|
+
const POSITION_ACTIONS = 'positionActions';
|
|
2726
2726
|
const RANKING_POINTS = 'rankingPoints';
|
|
2727
2727
|
const ROUND_TARGET = 'roundTarget';
|
|
2728
2728
|
const SCHEDULE_LIMITS = 'scheduleLimits';
|
|
@@ -2735,7 +2735,6 @@ const TIE_FORMAT_MODIFICATIONS = 'tieFormatModification';
|
|
|
2735
2735
|
const extensionConstants = {
|
|
2736
2736
|
ACTIVE_SUSPENSION,
|
|
2737
2737
|
APPLIED_POLICIES,
|
|
2738
|
-
AUDIT_POSITION_ACTIONS,
|
|
2739
2738
|
CONTEXT,
|
|
2740
2739
|
DELEGATED_OUTCOME,
|
|
2741
2740
|
DISABLED,
|
|
@@ -2753,6 +2752,7 @@ const extensionConstants = {
|
|
|
2753
2752
|
MATCHUP_HISTORY,
|
|
2754
2753
|
PARTICIPANT_REPRESENTATIVES,
|
|
2755
2754
|
PERSON_REQUESTS,
|
|
2755
|
+
POSITION_ACTIONS,
|
|
2756
2756
|
RANKING_POINTS,
|
|
2757
2757
|
ROUND_TARGET,
|
|
2758
2758
|
SCHEDULE_LIMITS,
|
|
@@ -3094,6 +3094,7 @@ const FEED_IN_CHAMPIONSHIP_TO_R16 = 'FEED_IN_CHAMPIONSHIP_TO_R16';
|
|
|
3094
3094
|
const MFIC = 'MODIFIED_FEED_IN_CHAMPIONSHIP';
|
|
3095
3095
|
const MODIFIED_FEED_IN_CHAMPIONSHIP = 'MODIFIED_FEED_IN_CHAMPIONSHIP';
|
|
3096
3096
|
const FEED_IN_CHAMPIONSHIP = 'FEED_IN_CHAMPIONSHIP';
|
|
3097
|
+
const DOUBLE_ROUND_ROBIN = 'DOUBLE_ROUND_ROBIN';
|
|
3097
3098
|
const ROUND_ROBIN = 'ROUND_ROBIN';
|
|
3098
3099
|
const ROUND_ROBIN_WITH_PLAYOFF = 'ROUND_ROBIN_WITH_PLAYOFF';
|
|
3099
3100
|
const DECIDER = 'DECIDER';
|
|
@@ -3618,9 +3619,12 @@ function conditionallyDisableLinkPositioning({ drawPositions, structure }) {
|
|
|
3618
3619
|
});
|
|
3619
3620
|
}
|
|
3620
3621
|
|
|
3621
|
-
function addPositionActionTelemetry(
|
|
3622
|
+
function addPositionActionTelemetry(params) {
|
|
3623
|
+
const { appliedPolicies, positionAction, drawDefinition } = params;
|
|
3624
|
+
if (appliedPolicies?.audit?.[POSITION_ACTIONS] === false)
|
|
3625
|
+
return;
|
|
3622
3626
|
const { extension } = findExtension({
|
|
3623
|
-
name:
|
|
3627
|
+
name: POSITION_ACTIONS,
|
|
3624
3628
|
element: drawDefinition,
|
|
3625
3629
|
});
|
|
3626
3630
|
const existingValue = Array.isArray(extension?.value) ? extension?.value ?? [] : [];
|
|
@@ -3642,8 +3646,8 @@ function addPositionActionTelemetry({ drawDefinition, positionAction }) {
|
|
|
3642
3646
|
}
|
|
3643
3647
|
}
|
|
3644
3648
|
const updatedExtension = {
|
|
3645
|
-
name: AUDIT_POSITION_ACTIONS,
|
|
3646
3649
|
value: existingValue.concat(positionAction),
|
|
3650
|
+
name: POSITION_ACTIONS,
|
|
3647
3651
|
};
|
|
3648
3652
|
addExtension({ element: drawDefinition, extension: updatedExtension });
|
|
3649
3653
|
}
|
|
@@ -5607,9 +5611,23 @@ function findTournamentParticipant(params) {
|
|
|
5607
5611
|
return { error: PARTICIPANT_NOT_FOUND };
|
|
5608
5612
|
}
|
|
5609
5613
|
|
|
5610
|
-
function
|
|
5611
|
-
|
|
5612
|
-
|
|
5614
|
+
function deriveElement(params) {
|
|
5615
|
+
const { tournamentRecord, participantId } = params;
|
|
5616
|
+
if (participantId) {
|
|
5617
|
+
const result = findTournamentParticipant({ tournamentRecord, participantId });
|
|
5618
|
+
return result.participant ?? result;
|
|
5619
|
+
}
|
|
5620
|
+
const element = params.element || params.drawDefinition || params.event || params.tournamentRecord;
|
|
5621
|
+
if (element)
|
|
5622
|
+
return element;
|
|
5623
|
+
return { error: MISSING_VALUE };
|
|
5624
|
+
}
|
|
5625
|
+
|
|
5626
|
+
function getTimeItem(params) {
|
|
5627
|
+
const { returnPreviousValues, itemSubTypes, itemType } = params;
|
|
5628
|
+
const element = deriveElement(params);
|
|
5629
|
+
if (element.error)
|
|
5630
|
+
return element;
|
|
5613
5631
|
if (itemSubTypes && !Array.isArray(itemSubTypes))
|
|
5614
5632
|
return { error: INVALID_VALUES, context: { itemSubTypes } };
|
|
5615
5633
|
if (!Array.isArray(element.timeItems))
|
|
@@ -6357,6 +6375,7 @@ const ASSIGN_COURT = 'SCHEDULE.ASSIGNMENT.COURT';
|
|
|
6357
6375
|
const COURT_ORDER = 'SCHEDULE.COURT.ORDER';
|
|
6358
6376
|
const SCHEDULED_DATE = 'SCHEDULE.DATE';
|
|
6359
6377
|
const COMPLETED_DATE = 'COMPLETED.DATE';
|
|
6378
|
+
const HOME_PARTICIPANT_ID = 'HOME_PARTICIPANT_ID';
|
|
6360
6379
|
const ASSIGN_OFFICIAL = 'SCHEDULE.ASSIGN.OFFICIAL';
|
|
6361
6380
|
const SCHEDULED_TIME = 'SCHEDULE.TIME.SCHEDULED';
|
|
6362
6381
|
const START_TIME = 'SCHEDULE.TIME.START';
|
|
@@ -6711,7 +6730,7 @@ function matchUpAssignedCourtId({ visibilityThreshold, timeStamp, schedule, matc
|
|
|
6711
6730
|
: schedule;
|
|
6712
6731
|
}
|
|
6713
6732
|
|
|
6714
|
-
function matchUpAssignedVenueId({ visibilityThreshold, timeStamp, schedule, matchUp
|
|
6733
|
+
function matchUpAssignedVenueId({ visibilityThreshold, timeStamp, schedule, matchUp }) {
|
|
6715
6734
|
const { itemValue: venueId, timeStamp: itemTimeStamp } = latestVisibleTimeItemValue({
|
|
6716
6735
|
timeItems: matchUp?.timeItems || [],
|
|
6717
6736
|
itemType: ASSIGN_VENUE,
|
|
@@ -7147,6 +7166,17 @@ function findEvent(params) {
|
|
|
7147
7166
|
};
|
|
7148
7167
|
}
|
|
7149
7168
|
|
|
7169
|
+
function getHomeParticipantId({ visibilityThreshold, timeStamp, schedule, matchUp }) {
|
|
7170
|
+
const { itemValue: homeParticipantId, timeStamp: itemTimeStamp } = latestVisibleTimeItemValue({
|
|
7171
|
+
timeItems: matchUp?.timeItems || [],
|
|
7172
|
+
itemType: HOME_PARTICIPANT_ID,
|
|
7173
|
+
visibilityThreshold,
|
|
7174
|
+
});
|
|
7175
|
+
return !schedule || (itemTimeStamp && timeStamp && new Date(itemTimeStamp).getTime() > new Date(timeStamp).getTime())
|
|
7176
|
+
? { homeParticipantId }
|
|
7177
|
+
: schedule;
|
|
7178
|
+
}
|
|
7179
|
+
|
|
7150
7180
|
function getMatchUpScheduleDetails(params) {
|
|
7151
7181
|
let event = params.event;
|
|
7152
7182
|
let matchUpType = params.matchUpType;
|
|
@@ -7180,12 +7210,13 @@ function getMatchUpScheduleDetails(params) {
|
|
|
7180
7210
|
if ((!eventIds || eventIds.includes(matchUp.eventId)) && (!drawIds || drawIds.includes(matchUp.drawId))) {
|
|
7181
7211
|
const scheduleSource = { matchUp, visibilityThreshold };
|
|
7182
7212
|
const { allocatedCourts } = matchUpAllocatedCourts(scheduleSource);
|
|
7213
|
+
const { homeParticipantId } = getHomeParticipantId(scheduleSource);
|
|
7183
7214
|
const { scheduledTime } = scheduledMatchUpTime(scheduleSource);
|
|
7215
|
+
const { timeModifiers } = matchUpTimeModifiers(scheduleSource);
|
|
7184
7216
|
let { scheduledDate } = scheduledMatchUpDate(scheduleSource);
|
|
7185
7217
|
const { venueId } = matchUpAssignedVenueId(scheduleSource);
|
|
7186
7218
|
const { courtId } = matchUpAssignedCourtId(scheduleSource);
|
|
7187
7219
|
const { courtOrder } = matchUpCourtOrder(scheduleSource);
|
|
7188
|
-
const { timeModifiers } = matchUpTimeModifiers(scheduleSource);
|
|
7189
7220
|
let timeAfterRecovery, averageMinutes, recoveryMinutes, typeChangeRecoveryMinutes, typeChangeTimeAfterRecovery;
|
|
7190
7221
|
const eventType = matchUp.matchUpType ?? matchUpType;
|
|
7191
7222
|
if (scheduleTiming && scheduledTime && afterRecoveryTimes && eventType) {
|
|
@@ -7243,6 +7274,7 @@ function getMatchUpScheduleDetails(params) {
|
|
|
7243
7274
|
scheduledTime,
|
|
7244
7275
|
isoDateString,
|
|
7245
7276
|
allocatedCourts,
|
|
7277
|
+
homeParticipantId,
|
|
7246
7278
|
timeModifiers,
|
|
7247
7279
|
venueAbbreviation,
|
|
7248
7280
|
venueName,
|
|
@@ -10395,6 +10427,11 @@ function assignDrawPositionBye({ provisionalPositioning, isPositionAction, tourn
|
|
|
10395
10427
|
if (filled && !containsBye) {
|
|
10396
10428
|
return decorateResult({ result: { error: DRAW_POSITION_ASSIGNED }, stack });
|
|
10397
10429
|
}
|
|
10430
|
+
const appliedPolicies = getAppliedPolicies({
|
|
10431
|
+
tournamentRecord,
|
|
10432
|
+
drawDefinition,
|
|
10433
|
+
event,
|
|
10434
|
+
}).appliedPolicies ?? {};
|
|
10398
10435
|
const inContextDrawMatchUps = getAllDrawMatchUps({
|
|
10399
10436
|
inContext: true,
|
|
10400
10437
|
drawDefinition,
|
|
@@ -10429,6 +10466,7 @@ function assignDrawPositionBye({ provisionalPositioning, isPositionAction, tourn
|
|
|
10429
10466
|
return successNotice({
|
|
10430
10467
|
assignedParticipantId,
|
|
10431
10468
|
isPositionAction,
|
|
10469
|
+
appliedPolicies,
|
|
10432
10470
|
drawDefinition,
|
|
10433
10471
|
drawPosition,
|
|
10434
10472
|
structureId,
|
|
@@ -10470,13 +10508,14 @@ function assignDrawPositionBye({ provisionalPositioning, isPositionAction, tourn
|
|
|
10470
10508
|
return successNotice({
|
|
10471
10509
|
assignedParticipantId,
|
|
10472
10510
|
isPositionAction,
|
|
10511
|
+
appliedPolicies,
|
|
10473
10512
|
drawDefinition,
|
|
10474
10513
|
drawPosition,
|
|
10475
10514
|
structureId,
|
|
10476
10515
|
stack,
|
|
10477
10516
|
});
|
|
10478
10517
|
}
|
|
10479
|
-
function successNotice({ assignedParticipantId, isPositionAction, drawDefinition, drawPosition, structureId, stack }) {
|
|
10518
|
+
function successNotice({ assignedParticipantId, isPositionAction, appliedPolicies, drawDefinition, drawPosition, structureId, stack, }) {
|
|
10480
10519
|
if (isPositionAction) {
|
|
10481
10520
|
const positionAction = {
|
|
10482
10521
|
removedParticipantId: assignedParticipantId,
|
|
@@ -10484,7 +10523,7 @@ function successNotice({ assignedParticipantId, isPositionAction, drawDefinition
|
|
|
10484
10523
|
structureId,
|
|
10485
10524
|
name: stack,
|
|
10486
10525
|
};
|
|
10487
|
-
addPositionActionTelemetry({ drawDefinition, positionAction });
|
|
10526
|
+
addPositionActionTelemetry({ appliedPolicies, drawDefinition, positionAction });
|
|
10488
10527
|
}
|
|
10489
10528
|
return decorateResult({ result: { ...SUCCESS }, stack });
|
|
10490
10529
|
}
|
|
@@ -13540,6 +13579,11 @@ function removeDrawPositionAssignment(params) {
|
|
|
13540
13579
|
return decorateResult({ result, stack });
|
|
13541
13580
|
const { participantId } = result;
|
|
13542
13581
|
const { drawPosition, event, structureId } = params;
|
|
13582
|
+
const appliedPolicies = getAppliedPolicies({
|
|
13583
|
+
tournamentRecord,
|
|
13584
|
+
drawDefinition,
|
|
13585
|
+
event,
|
|
13586
|
+
}).appliedPolicies ?? {};
|
|
13543
13587
|
if ([ALTERNATE, WITHDRAWN].includes(entryStatus) && participantId) {
|
|
13544
13588
|
const { tournamentRecord } = params;
|
|
13545
13589
|
const { participant } = findTournamentParticipant({
|
|
@@ -13601,7 +13645,7 @@ function removeDrawPositionAssignment(params) {
|
|
|
13601
13645
|
entryStatus,
|
|
13602
13646
|
structureId,
|
|
13603
13647
|
};
|
|
13604
|
-
addPositionActionTelemetry({ drawDefinition, positionAction });
|
|
13648
|
+
addPositionActionTelemetry({ appliedPolicies, drawDefinition, positionAction });
|
|
13605
13649
|
return result;
|
|
13606
13650
|
}
|
|
13607
13651
|
|
|
@@ -15178,6 +15222,11 @@ function positionParticipantAction(params) {
|
|
|
15178
15222
|
const stack = 'positionParticipantAction';
|
|
15179
15223
|
if (!drawDefinition)
|
|
15180
15224
|
return { error: MISSING_DRAW_DEFINITION };
|
|
15225
|
+
const appliedPolicies = getAppliedPolicies({
|
|
15226
|
+
tournamentRecord,
|
|
15227
|
+
drawDefinition,
|
|
15228
|
+
event,
|
|
15229
|
+
}).appliedPolicies ?? {};
|
|
15181
15230
|
let { inContextDrawMatchUps, matchUpsMap } = params;
|
|
15182
15231
|
if (!matchUpsMap) {
|
|
15183
15232
|
matchUpsMap = getMatchUpsMap({ drawDefinition });
|
|
@@ -15211,9 +15260,7 @@ function positionParticipantAction(params) {
|
|
|
15211
15260
|
if (!result.success) {
|
|
15212
15261
|
return decorateResult({ result, stack });
|
|
15213
15262
|
}
|
|
15214
|
-
return successNotice({
|
|
15215
|
-
removedParticipantId,
|
|
15216
|
-
});
|
|
15263
|
+
return successNotice({ appliedPolicies, removedParticipantId });
|
|
15217
15264
|
}
|
|
15218
15265
|
const result = clearDrawPosition({
|
|
15219
15266
|
inContextDrawMatchUps,
|
|
@@ -15240,8 +15287,8 @@ function positionParticipantAction(params) {
|
|
|
15240
15287
|
});
|
|
15241
15288
|
if (!assignResult.success)
|
|
15242
15289
|
return decorateResult({ result: assignResult, stack });
|
|
15243
|
-
return successNotice({ removedParticipantId });
|
|
15244
|
-
function successNotice({ removedParticipantId }) {
|
|
15290
|
+
return successNotice({ appliedPolicies, removedParticipantId });
|
|
15291
|
+
function successNotice({ appliedPolicies, removedParticipantId }) {
|
|
15245
15292
|
const { structure } = findStructure({ drawDefinition, structureId });
|
|
15246
15293
|
conditionallyDisableLinkPositioning({
|
|
15247
15294
|
drawPositions: [drawPosition],
|
|
@@ -15253,7 +15300,7 @@ function positionParticipantAction(params) {
|
|
|
15253
15300
|
drawPosition,
|
|
15254
15301
|
structureId,
|
|
15255
15302
|
};
|
|
15256
|
-
addPositionActionTelemetry({ drawDefinition, positionAction });
|
|
15303
|
+
addPositionActionTelemetry({ appliedPolicies, drawDefinition, positionAction });
|
|
15257
15304
|
return decorateResult({
|
|
15258
15305
|
context: { removedParticipantId },
|
|
15259
15306
|
result: { ...SUCCESS },
|
|
@@ -15489,9 +15536,8 @@ function swapDrawPositionAssignments$1({ tournamentRecord, drawDefinition, drawP
|
|
|
15489
15536
|
return { error: MISSING_DRAW_DEFINITION };
|
|
15490
15537
|
if (!structureId)
|
|
15491
15538
|
return { error: MISSING_STRUCTURE_ID };
|
|
15492
|
-
if (drawPositions?.length !== 2)
|
|
15539
|
+
if (drawPositions?.length !== 2)
|
|
15493
15540
|
return { error: INVALID_VALUES, drawPositions };
|
|
15494
|
-
}
|
|
15495
15541
|
const matchUpsMap = getMatchUpsMap({ drawDefinition });
|
|
15496
15542
|
const { matchUps: inContextDrawMatchUps } = getAllDrawMatchUps({
|
|
15497
15543
|
inContext: true,
|
|
@@ -15501,6 +15547,11 @@ function swapDrawPositionAssignments$1({ tournamentRecord, drawDefinition, drawP
|
|
|
15501
15547
|
const { structure } = findStructure({ drawDefinition, structureId });
|
|
15502
15548
|
if (!structure)
|
|
15503
15549
|
return { error: STRUCTURE_NOT_FOUND };
|
|
15550
|
+
const appliedPolicies = getAppliedPolicies({
|
|
15551
|
+
tournamentRecord,
|
|
15552
|
+
drawDefinition,
|
|
15553
|
+
event,
|
|
15554
|
+
}).appliedPolicies ?? {};
|
|
15504
15555
|
let result;
|
|
15505
15556
|
if (structure.structureType === CONTAINER) {
|
|
15506
15557
|
result = roundRobinSwap({
|
|
@@ -15532,7 +15583,7 @@ function swapDrawPositionAssignments$1({ tournamentRecord, drawDefinition, drawP
|
|
|
15532
15583
|
drawPositions,
|
|
15533
15584
|
structureId,
|
|
15534
15585
|
};
|
|
15535
|
-
addPositionActionTelemetry({ drawDefinition, positionAction });
|
|
15586
|
+
addPositionActionTelemetry({ appliedPolicies, drawDefinition, positionAction });
|
|
15536
15587
|
modifyPositionAssignmentsNotice({
|
|
15537
15588
|
tournamentId: tournamentRecord?.tournamentId,
|
|
15538
15589
|
drawDefinition,
|
|
@@ -17653,50 +17704,44 @@ function resequenceStructures({ drawDefinition }) {
|
|
|
17653
17704
|
}
|
|
17654
17705
|
|
|
17655
17706
|
function addTimeItem(params) {
|
|
17656
|
-
const { duplicateValues = true, creationTime = true, removePriorValues, timeItem
|
|
17707
|
+
const { duplicateValues = true, creationTime = true, removePriorValues, timeItem } = params;
|
|
17657
17708
|
if (!timeItem)
|
|
17658
17709
|
return { error: MISSING_TIME_ITEM };
|
|
17659
|
-
|
|
17660
|
-
|
|
17661
|
-
|
|
17662
|
-
const
|
|
17663
|
-
const validTimeItem = requiredAttributes.filter((attribute) => timeItemAttributes.includes(attribute)).length ===
|
|
17664
|
-
requiredAttributes.length;
|
|
17710
|
+
const element = deriveElement(params);
|
|
17711
|
+
if (element.error)
|
|
17712
|
+
return element;
|
|
17713
|
+
const validTimeItem = isObject(timeItem) && isString(timeItem.itemType) && Object.keys(timeItem).includes('itemValue');
|
|
17665
17714
|
if (!validTimeItem)
|
|
17666
17715
|
return { error: INVALID_TIME_ITEM };
|
|
17667
17716
|
if (!element.timeItems) {
|
|
17668
17717
|
element.timeItems = [];
|
|
17669
17718
|
}
|
|
17670
|
-
else {
|
|
17671
|
-
|
|
17672
|
-
const existingTimeItem = itemType &&
|
|
17673
|
-
getTimeItem({
|
|
17674
|
-
itemSubTypes,
|
|
17675
|
-
itemType,
|
|
17676
|
-
element,
|
|
17677
|
-
})?.timeItem;
|
|
17678
|
-
if (existingTimeItem &&
|
|
17679
|
-
JSON.stringify(existingTimeItem?.itemValue) === JSON.stringify(itemValue) &&
|
|
17680
|
-
!duplicateValues) {
|
|
17681
|
-
return { ...SUCCESS };
|
|
17682
|
-
}
|
|
17719
|
+
else if (hasEquivalentTimeItem({ element, duplicateValues, timeItem })) {
|
|
17720
|
+
return { ...SUCCESS };
|
|
17683
17721
|
}
|
|
17684
|
-
if (timeItem.itemSubTypes && !timeItem.itemSubTypes.length)
|
|
17722
|
+
if (timeItem.itemSubTypes && !timeItem.itemSubTypes.length)
|
|
17685
17723
|
delete timeItem.itemSubTypes;
|
|
17686
|
-
}
|
|
17687
17724
|
if (creationTime) {
|
|
17688
17725
|
const createdAt = new Date().toISOString();
|
|
17689
17726
|
Object.assign(timeItem, { createdAt });
|
|
17690
17727
|
}
|
|
17691
|
-
if (removePriorValues)
|
|
17728
|
+
if (removePriorValues)
|
|
17692
17729
|
element.timeItems = element.timeItems.filter(({ itemType }) => timeItem.itemType !== itemType);
|
|
17693
|
-
}
|
|
17694
17730
|
const doNotAdd = removePriorValues && !timeItem.itemValue;
|
|
17695
|
-
if (!doNotAdd)
|
|
17731
|
+
if (!doNotAdd)
|
|
17696
17732
|
element.timeItems.push(timeItem);
|
|
17697
|
-
}
|
|
17698
17733
|
return { ...SUCCESS };
|
|
17699
17734
|
}
|
|
17735
|
+
function hasEquivalentTimeItem({ element, duplicateValues, timeItem }) {
|
|
17736
|
+
const { itemType, itemSubTypes, itemValue } = timeItem;
|
|
17737
|
+
const existingTimeItem = itemType &&
|
|
17738
|
+
getTimeItem({
|
|
17739
|
+
itemSubTypes,
|
|
17740
|
+
itemType,
|
|
17741
|
+
element,
|
|
17742
|
+
})?.timeItem;
|
|
17743
|
+
return (existingTimeItem && JSON.stringify(existingTimeItem?.itemValue) === JSON.stringify(itemValue) && !duplicateValues);
|
|
17744
|
+
}
|
|
17700
17745
|
function addParticipantTimeItem({ creationTime = true, removePriorValues, tournamentRecord, duplicateValues, participantId, timeItem, }) {
|
|
17701
17746
|
if (!tournamentRecord)
|
|
17702
17747
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
@@ -38229,10 +38274,8 @@ function deleteDrawDefinitions(params) {
|
|
|
38229
38274
|
matchUpIds,
|
|
38230
38275
|
});
|
|
38231
38276
|
}
|
|
38232
|
-
drawIds.forEach((drawId) => {
|
|
38233
|
-
|
|
38234
|
-
});
|
|
38235
|
-
addDrawDeletionTelemetry({ event, deletedDrawsDetail, auditData });
|
|
38277
|
+
drawIds.forEach((drawId) => deleteDrawNotice({ drawId }));
|
|
38278
|
+
addDrawDeletionTelemetry({ appliedPolicies, event, deletedDrawsDetail, auditData });
|
|
38236
38279
|
if (autoPublish && publishedDrawsDeleted) {
|
|
38237
38280
|
const result = publishEvent({
|
|
38238
38281
|
drawIdsToRemove: drawIds,
|
|
@@ -38245,15 +38288,17 @@ function deleteDrawDefinitions(params) {
|
|
|
38245
38288
|
}
|
|
38246
38289
|
return { ...SUCCESS };
|
|
38247
38290
|
}
|
|
38248
|
-
function addDrawDeletionTelemetry({ event, deletedDrawsDetail, auditData }) {
|
|
38291
|
+
function addDrawDeletionTelemetry({ appliedPolicies, event, deletedDrawsDetail, auditData }) {
|
|
38292
|
+
if (appliedPolicies?.audit?.[DRAW_DELETIONS] === false)
|
|
38293
|
+
return;
|
|
38249
38294
|
const { extension } = findExtension({
|
|
38250
38295
|
name: DRAW_DELETIONS,
|
|
38251
38296
|
element: event,
|
|
38252
38297
|
});
|
|
38253
38298
|
const deletionData = { ...auditData, deletedDrawsDetail };
|
|
38254
38299
|
const updatedExtension = {
|
|
38255
|
-
name: DRAW_DELETIONS,
|
|
38256
38300
|
value: Array.isArray(extension?.value) ? extension?.value.concat(deletionData) : [deletionData],
|
|
38301
|
+
name: DRAW_DELETIONS,
|
|
38257
38302
|
};
|
|
38258
38303
|
addExtension({ element: event, extension: updatedExtension });
|
|
38259
38304
|
}
|
|
@@ -39167,25 +39212,25 @@ function deleteEvents({ removePairParticipants, tournamentRecord, eventIds }) {
|
|
|
39167
39212
|
return { ...SUCCESS };
|
|
39168
39213
|
}
|
|
39169
39214
|
|
|
39170
|
-
function modifyEvent(
|
|
39215
|
+
function modifyEvent(params) {
|
|
39216
|
+
const paramsCheck = checkRequiredParameters(params, [
|
|
39217
|
+
{ tournamentRecord: true, eventId: true, event: true },
|
|
39218
|
+
{ eventUpdates: true, _ofType: OBJECT },
|
|
39219
|
+
]);
|
|
39220
|
+
if (paramsCheck.error)
|
|
39221
|
+
return paramsCheck;
|
|
39222
|
+
const { tournamentRecord, eventUpdates, event } = params;
|
|
39171
39223
|
const stack = 'modifyEvent';
|
|
39172
|
-
if (
|
|
39173
|
-
|
|
39174
|
-
|
|
39175
|
-
|
|
39176
|
-
|
|
39177
|
-
|
|
39178
|
-
return decorateResult({
|
|
39179
|
-
result: { error: MISSING_EVENT },
|
|
39180
|
-
context: { eventId },
|
|
39181
|
-
stack,
|
|
39182
|
-
});
|
|
39183
|
-
if (!isObject(eventUpdates))
|
|
39184
|
-
return decorateResult({
|
|
39185
|
-
result: { error: INVALID_VALUES },
|
|
39186
|
-
context: { eventUpdates },
|
|
39187
|
-
stack,
|
|
39224
|
+
if (eventUpdates.startDate || eventUpdates.endDate) {
|
|
39225
|
+
const result = setEventDates({
|
|
39226
|
+
startDate: eventUpdates.startDate,
|
|
39227
|
+
endDate: eventUpdates.endDate,
|
|
39228
|
+
tournamentRecord,
|
|
39229
|
+
event,
|
|
39188
39230
|
});
|
|
39231
|
+
if (result.error)
|
|
39232
|
+
return decorateResult({ result, stack });
|
|
39233
|
+
}
|
|
39189
39234
|
const enteredParticipantIds = event?.entries
|
|
39190
39235
|
?.filter(({ entryStatus }) => {
|
|
39191
39236
|
const status = entryStatus;
|
|
@@ -42616,30 +42661,21 @@ function scoreModification(params) {
|
|
|
42616
42661
|
return decorateResult({ result, stack });
|
|
42617
42662
|
}
|
|
42618
42663
|
|
|
42619
|
-
function
|
|
42620
|
-
const
|
|
42621
|
-
|
|
42622
|
-
|
|
42623
|
-
|
|
42624
|
-
|
|
42625
|
-
|
|
42626
|
-
|
|
42627
|
-
|
|
42628
|
-
|
|
42629
|
-
tieMatchUp.matchUpStatus = matchUpStatus;
|
|
42630
|
-
}
|
|
42631
|
-
}
|
|
42632
|
-
}
|
|
42633
|
-
tieFormat = tieFormat ?? resolveTieFormat({ matchUp, structure, drawDefinition, event })?.tieFormat;
|
|
42634
|
-
const { winningSide: projectedWinningSide } = generateTieMatchUpScore({
|
|
42635
|
-
matchUp: projectedDualMatchUp,
|
|
42664
|
+
function setMatchUpHomeParticipantId(params) {
|
|
42665
|
+
const { disableNotice = true, homeParticipantId, removePriorValues, tournamentRecord, drawDefinition, matchUpId, } = params;
|
|
42666
|
+
const timeItem = {
|
|
42667
|
+
itemValue: homeParticipantId,
|
|
42668
|
+
itemType: HOME_PARTICIPANT_ID,
|
|
42669
|
+
};
|
|
42670
|
+
return addMatchUpTimeItem({
|
|
42671
|
+
duplicateValues: false,
|
|
42672
|
+
removePriorValues,
|
|
42673
|
+
tournamentRecord,
|
|
42636
42674
|
drawDefinition,
|
|
42637
|
-
|
|
42638
|
-
|
|
42639
|
-
|
|
42640
|
-
event,
|
|
42675
|
+
disableNotice,
|
|
42676
|
+
matchUpId,
|
|
42677
|
+
timeItem,
|
|
42641
42678
|
});
|
|
42642
|
-
return { projectedWinningSide };
|
|
42643
42679
|
}
|
|
42644
42680
|
|
|
42645
42681
|
function addMatchUpScheduledTime(params) {
|
|
@@ -42739,6 +42775,28 @@ function addMatchUpTimeModifiers({ removePriorValues, tournamentRecord, drawDefi
|
|
|
42739
42775
|
});
|
|
42740
42776
|
}
|
|
42741
42777
|
|
|
42778
|
+
function addMatchUpScheduledDate({ scheduledDate: dateToSchedule, removePriorValues, tournamentRecord, drawDefinition, disableNotice, matchUpId, }) {
|
|
42779
|
+
if (!matchUpId)
|
|
42780
|
+
return { error: MISSING_MATCHUP_ID };
|
|
42781
|
+
const validDate = dateToSchedule && dateValidation.test(dateToSchedule);
|
|
42782
|
+
if (dateToSchedule && !validDate)
|
|
42783
|
+
return { error: INVALID_DATE };
|
|
42784
|
+
const scheduledDate = extractDate(dateToSchedule);
|
|
42785
|
+
const timeItem = {
|
|
42786
|
+
itemValue: scheduledDate,
|
|
42787
|
+
itemType: SCHEDULED_DATE,
|
|
42788
|
+
};
|
|
42789
|
+
return addMatchUpTimeItem({
|
|
42790
|
+
duplicateValues: false,
|
|
42791
|
+
removePriorValues,
|
|
42792
|
+
tournamentRecord,
|
|
42793
|
+
drawDefinition,
|
|
42794
|
+
disableNotice,
|
|
42795
|
+
matchUpId,
|
|
42796
|
+
timeItem,
|
|
42797
|
+
});
|
|
42798
|
+
}
|
|
42799
|
+
|
|
42742
42800
|
function allocateTeamMatchUpCourts({ removePriorValues, tournamentRecords, tournamentRecord, drawDefinition, disableNotice, courtDayDate, matchUpId, courtIds, }) {
|
|
42743
42801
|
if (!tournamentRecord && !tournamentRecords)
|
|
42744
42802
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
@@ -42866,14 +42924,16 @@ function timeDate(value, scheduledDate) {
|
|
|
42866
42924
|
const date = extractDate(value) || extractDate(scheduledDate) || formatDate(new Date());
|
|
42867
42925
|
return new Date(`${date}T${time}`).getTime();
|
|
42868
42926
|
}
|
|
42869
|
-
function addMatchUpScheduleItems(
|
|
42870
|
-
if (!schedule)
|
|
42871
|
-
return { error: MISSING_VALUE, info: 'Missing schedule' };
|
|
42872
|
-
if (!drawDefinition)
|
|
42873
|
-
return { error: MISSING_DRAW_DEFINITION };
|
|
42874
|
-
if (!matchUpId)
|
|
42875
|
-
return { error: MISSING_MATCHUP_ID };
|
|
42927
|
+
function addMatchUpScheduleItems(params) {
|
|
42876
42928
|
const stack = 'addMatchUpScheduleItems';
|
|
42929
|
+
const paramsCheck = checkRequiredParameters(params, [
|
|
42930
|
+
{ drawDefinition: true, matchUpId: true },
|
|
42931
|
+
{ schedule: true, [OF_TYPE]: OBJECT },
|
|
42932
|
+
], stack);
|
|
42933
|
+
if (paramsCheck.error)
|
|
42934
|
+
return paramsCheck;
|
|
42935
|
+
let { matchUpDependencies, inContextMatchUps } = params;
|
|
42936
|
+
const { errorOnAnachronism = false, checkChronology = true, removePriorValues, tournamentRecords, tournamentRecord, drawDefinition, disableNotice, drawMatchUps, matchUpId, schedule, event, } = params;
|
|
42877
42937
|
let matchUp, warning;
|
|
42878
42938
|
if (!drawMatchUps) {
|
|
42879
42939
|
const result = findDrawMatchUp({ drawDefinition, event, matchUpId });
|
|
@@ -42884,7 +42944,7 @@ function addMatchUpScheduleItems({ errorOnAnachronism = false, checkChronology =
|
|
|
42884
42944
|
else {
|
|
42885
42945
|
matchUp = drawMatchUps.find((drawMatchUp) => drawMatchUp.matchUpId === matchUpId);
|
|
42886
42946
|
}
|
|
42887
|
-
const { endTime, courtId, courtIds, courtOrder, resumeTime, scheduledDate, scheduledTime, startTime, stopTime, timeModifiers, venueId, } = schedule;
|
|
42947
|
+
const { endTime, courtId, courtIds, courtOrder, resumeTime, homeParticipantId, scheduledDate, scheduledTime, startTime, stopTime, timeModifiers, venueId, } = schedule;
|
|
42888
42948
|
if (checkChronology && (!matchUpDependencies || !inContextMatchUps)) {
|
|
42889
42949
|
({ matchUpDependencies, matchUps: inContextMatchUps } = getMatchUpDependencies({
|
|
42890
42950
|
drawDefinition,
|
|
@@ -43054,6 +43114,16 @@ function addMatchUpScheduleItems({ errorOnAnachronism = false, checkChronology =
|
|
|
43054
43114
|
if (result?.error)
|
|
43055
43115
|
return decorateResult({ result, stack, context: { timeModifiers } });
|
|
43056
43116
|
}
|
|
43117
|
+
if (isString(homeParticipantId)) {
|
|
43118
|
+
setMatchUpHomeParticipantId({
|
|
43119
|
+
disableNotice: true,
|
|
43120
|
+
homeParticipantId,
|
|
43121
|
+
removePriorValues,
|
|
43122
|
+
tournamentRecord,
|
|
43123
|
+
drawDefinition,
|
|
43124
|
+
matchUpId,
|
|
43125
|
+
});
|
|
43126
|
+
}
|
|
43057
43127
|
if (!disableNotice) {
|
|
43058
43128
|
modifyMatchUpNotice({
|
|
43059
43129
|
tournamentId: tournamentRecord?.tournamentId,
|
|
@@ -43065,27 +43135,6 @@ function addMatchUpScheduleItems({ errorOnAnachronism = false, checkChronology =
|
|
|
43065
43135
|
}
|
|
43066
43136
|
return warning ? { ...SUCCESS, warnings: [warning] } : { ...SUCCESS };
|
|
43067
43137
|
}
|
|
43068
|
-
function addMatchUpScheduledDate({ scheduledDate: dateToSchedule, removePriorValues, tournamentRecord, drawDefinition, disableNotice, matchUpId, }) {
|
|
43069
|
-
if (!matchUpId)
|
|
43070
|
-
return { error: MISSING_MATCHUP_ID };
|
|
43071
|
-
const validDate = dateToSchedule && dateValidation.test(dateToSchedule);
|
|
43072
|
-
if (dateToSchedule && !validDate)
|
|
43073
|
-
return { error: INVALID_DATE };
|
|
43074
|
-
const scheduledDate = extractDate(dateToSchedule);
|
|
43075
|
-
const timeItem = {
|
|
43076
|
-
itemValue: scheduledDate,
|
|
43077
|
-
itemType: SCHEDULED_DATE,
|
|
43078
|
-
};
|
|
43079
|
-
return addMatchUpTimeItem({
|
|
43080
|
-
duplicateValues: false,
|
|
43081
|
-
removePriorValues,
|
|
43082
|
-
tournamentRecord,
|
|
43083
|
-
drawDefinition,
|
|
43084
|
-
disableNotice,
|
|
43085
|
-
matchUpId,
|
|
43086
|
-
timeItem,
|
|
43087
|
-
});
|
|
43088
|
-
}
|
|
43089
43138
|
function addMatchUpCourtOrder({ removePriorValues, tournamentRecord, drawDefinition, disableNotice, courtOrder, matchUpId, }) {
|
|
43090
43139
|
if (!matchUpId)
|
|
43091
43140
|
return { error: MISSING_MATCHUP_ID };
|
|
@@ -43299,6 +43348,32 @@ function addMatchUpResumeTime({ removePriorValues, tournamentRecord, drawDefinit
|
|
|
43299
43348
|
}
|
|
43300
43349
|
}
|
|
43301
43350
|
|
|
43351
|
+
function getProjectedDualWinningSide({ drawDefinition, matchUpStatus, matchUpsMap, winningSide, dualMatchUp, tieFormat, structure, matchUp, event, score, }) {
|
|
43352
|
+
const projectedDualMatchUp = makeDeepCopy(dualMatchUp, undefined, true);
|
|
43353
|
+
for (const tieMatchUp of projectedDualMatchUp?.tieMatchUps || []) {
|
|
43354
|
+
if (tieMatchUp.matchUpId === matchUp.matchUpId) {
|
|
43355
|
+
tieMatchUp.winningSide = winningSide;
|
|
43356
|
+
tieMatchUp.score = score;
|
|
43357
|
+
if (!checkScoreHasValue({ score }) && !matchUpStatus) {
|
|
43358
|
+
Object.assign(tieMatchUp, { ...toBePlayed });
|
|
43359
|
+
}
|
|
43360
|
+
else if (matchUpStatus) {
|
|
43361
|
+
tieMatchUp.matchUpStatus = matchUpStatus;
|
|
43362
|
+
}
|
|
43363
|
+
}
|
|
43364
|
+
}
|
|
43365
|
+
tieFormat = tieFormat ?? resolveTieFormat({ matchUp, structure, drawDefinition, event })?.tieFormat;
|
|
43366
|
+
const { winningSide: projectedWinningSide } = generateTieMatchUpScore({
|
|
43367
|
+
matchUp: projectedDualMatchUp,
|
|
43368
|
+
drawDefinition,
|
|
43369
|
+
matchUpsMap,
|
|
43370
|
+
structure,
|
|
43371
|
+
tieFormat,
|
|
43372
|
+
event,
|
|
43373
|
+
});
|
|
43374
|
+
return { projectedWinningSide };
|
|
43375
|
+
}
|
|
43376
|
+
|
|
43302
43377
|
function swapWinnerLoser(params) {
|
|
43303
43378
|
const { tournamentRecord, inContextMatchUp, structure, drawDefinition } = params;
|
|
43304
43379
|
const matchUpRoundNumber = inContextMatchUp.roundNumber;
|
|
@@ -46797,6 +46872,11 @@ function postalCodeMocks({ count = 1, participantsCount = 32 } = {}) {
|
|
|
46797
46872
|
return { postalCodes };
|
|
46798
46873
|
}
|
|
46799
46874
|
|
|
46875
|
+
function genParticipantId({ idPrefix, participantType, index, uuids }) {
|
|
46876
|
+
const type = participantType === INDIVIDUAL ? 'I' : 'P' ;
|
|
46877
|
+
return idPrefix ? `${idPrefix}-${type}-${index}` : uuids?.pop() || UUID();
|
|
46878
|
+
}
|
|
46879
|
+
|
|
46800
46880
|
function generateAddress(addressAttributes) {
|
|
46801
46881
|
const { cities, states, postalCodes, nationalityCode, participantIndex } = addressAttributes;
|
|
46802
46882
|
return {
|
|
@@ -47294,11 +47374,6 @@ function nameMocks({ nameRoot = 'TEAM', count = 1 } = {}) {
|
|
|
47294
47374
|
return { names };
|
|
47295
47375
|
}
|
|
47296
47376
|
|
|
47297
|
-
function genParticipantId({ idPrefix, participantType, index, uuids }) {
|
|
47298
|
-
const type = participantType === INDIVIDUAL ? 'I' : 'P' ;
|
|
47299
|
-
return idPrefix ? `${idPrefix}-${type}-${index}` : uuids?.pop() || UUID();
|
|
47300
|
-
}
|
|
47301
|
-
|
|
47302
47377
|
function generateParticipants(params) {
|
|
47303
47378
|
let { rankingRange, scaledParticipantsCount, } = params;
|
|
47304
47379
|
const { ratingsParameters: ratingsParameters$1 = ratingsParameters, valuesInstanceLimit, consideredDate, category, nationalityCodesCount, nationalityCodeType, nationalityCodes, participantsCount = 32, participantType, personIds, idPrefix, uuids, personExtensions, addressProps, gendersCount, matchUpType, personData, sex, inContext, withISO2, withIOC, scaleAllParticipants, } = params;
|
|
@@ -47551,12 +47626,13 @@ function addScaleItem({ scaleValue: itemValue, participant, eventType, scaleType
|
|
|
47551
47626
|
}
|
|
47552
47627
|
}
|
|
47553
47628
|
|
|
47554
|
-
function processTieFormat(
|
|
47629
|
+
function processTieFormat(params) {
|
|
47630
|
+
const { alternatesCount = 0, tieFormatName, drawSize } = params;
|
|
47555
47631
|
let maxDoublesCount = 0, maxSinglesCount = 0;
|
|
47556
47632
|
let singlesMatchUpTotal = 0, doublesMatchUpTotal = 0;
|
|
47557
47633
|
const categories = {};
|
|
47558
47634
|
const genders = { [MALE]: 0, [FEMALE]: 0, [MIXED]: 0, [OTHER$2]: 0, [ANY]: 0 };
|
|
47559
|
-
tieFormat =
|
|
47635
|
+
const tieFormat = isObject(params.tieFormat) ? params.tieFormat : tieFormatDefaults({ namedFormat: tieFormatName });
|
|
47560
47636
|
tieFormat?.collectionDefinitions?.filter(Boolean).forEach((collectionDefinition) => {
|
|
47561
47637
|
const { category, collectionId, matchUpType, matchUpCount, gender } = collectionDefinition;
|
|
47562
47638
|
if ([MALE, FEMALE].includes(gender)) {
|
|
@@ -47709,12 +47785,12 @@ function addTournamentParticipants({ participantsProfile, tournamentRecord, even
|
|
|
47709
47785
|
});
|
|
47710
47786
|
const teamKey = participantsProfile?.teamKey;
|
|
47711
47787
|
const participants = generateParticipants({
|
|
47712
|
-
uuids,
|
|
47713
|
-
...participantsProfile,
|
|
47714
47788
|
consideredDate: startDate,
|
|
47789
|
+
...participantsProfile,
|
|
47715
47790
|
participantsCount,
|
|
47716
47791
|
participantType,
|
|
47717
47792
|
gendersCount,
|
|
47793
|
+
uuids,
|
|
47718
47794
|
}).participants;
|
|
47719
47795
|
let addedCount = 0;
|
|
47720
47796
|
let result = addParticipants({ tournamentRecord, participants });
|
|
@@ -48699,7 +48775,7 @@ function generateEventWithDraw(params) {
|
|
|
48699
48775
|
const eventId = drawProfileCopy.eventId || UUID();
|
|
48700
48776
|
const eventType = drawProfile.eventType || drawProfile.matchUpType || SINGLES$1;
|
|
48701
48777
|
const participantType = eventType === DOUBLES$1 ? PAIR : INDIVIDUAL;
|
|
48702
|
-
const tieFormat = (
|
|
48778
|
+
const tieFormat = (isObject(drawProfile.tieFormat) && drawProfile.tieFormat) ||
|
|
48703
48779
|
(eventType === TEAM &&
|
|
48704
48780
|
tieFormatDefaults({
|
|
48705
48781
|
event: { eventId, category, gender },
|
|
@@ -49353,7 +49429,7 @@ function courtsAdd({ courtNameRoot = 'Court', dateAvailability = [], venueAbbrev
|
|
|
49353
49429
|
return { ...SUCCESS, courts: makeDeepCopy(courtRecords) };
|
|
49354
49430
|
}
|
|
49355
49431
|
|
|
49356
|
-
function generateVenues({ tournamentRecord, venueProfiles, uuids }) {
|
|
49432
|
+
function generateVenues({ tournamentRecord, ignoreExistingVenues, venueProfiles, uuids }) {
|
|
49357
49433
|
const { startDate, endDate } = tournamentRecord;
|
|
49358
49434
|
const venueIds = [];
|
|
49359
49435
|
for (const [index, venueProfile] of venueProfiles.entries()) {
|
|
@@ -49364,8 +49440,11 @@ function generateVenues({ tournamentRecord, venueProfiles, uuids }) {
|
|
|
49364
49440
|
venueId,
|
|
49365
49441
|
};
|
|
49366
49442
|
const result = addVenue({ tournamentRecord, venue: newVenue });
|
|
49367
|
-
if (result.error)
|
|
49443
|
+
if (result.error) {
|
|
49444
|
+
if (ignoreExistingVenues)
|
|
49445
|
+
continue;
|
|
49368
49446
|
return result;
|
|
49447
|
+
}
|
|
49369
49448
|
venueIds.push(venueId);
|
|
49370
49449
|
const dates = generateDateRange(startDate, endDate);
|
|
49371
49450
|
const generatedDateAvailability = !Array.isArray(dateAvailability) &&
|
|
@@ -49374,39 +49453,142 @@ function generateVenues({ tournamentRecord, venueProfiles, uuids }) {
|
|
|
49374
49453
|
startTime,
|
|
49375
49454
|
endTime,
|
|
49376
49455
|
})));
|
|
49377
|
-
|
|
49378
|
-
|
|
49379
|
-
|
|
49380
|
-
|
|
49381
|
-
|
|
49382
|
-
|
|
49383
|
-
|
|
49384
|
-
|
|
49385
|
-
|
|
49386
|
-
|
|
49387
|
-
|
|
49388
|
-
|
|
49389
|
-
|
|
49390
|
-
|
|
49391
|
-
|
|
49456
|
+
if (courtsCount || courtNames) {
|
|
49457
|
+
const addResult = addCourts({
|
|
49458
|
+
dateAvailability: dateAvailability || generatedDateAvailability,
|
|
49459
|
+
tournamentRecord,
|
|
49460
|
+
courtTimings,
|
|
49461
|
+
courtsCount,
|
|
49462
|
+
courtNames,
|
|
49463
|
+
startTime,
|
|
49464
|
+
idPrefix,
|
|
49465
|
+
courtIds,
|
|
49466
|
+
endTime,
|
|
49467
|
+
venueId,
|
|
49468
|
+
dates,
|
|
49469
|
+
});
|
|
49470
|
+
if (addResult.error)
|
|
49471
|
+
return addResult;
|
|
49472
|
+
}
|
|
49392
49473
|
}
|
|
49393
49474
|
return venueIds;
|
|
49394
49475
|
}
|
|
49395
49476
|
|
|
49477
|
+
function processLeagueProfiles(params) {
|
|
49478
|
+
const { tournamentRecord, leagueProfiles, eventIds, venueIds, drawIds, allUniqueParticipantIds, uuids } = params;
|
|
49479
|
+
let leaguesCount = 0;
|
|
49480
|
+
for (const leagueProfile of leagueProfiles) {
|
|
49481
|
+
const entries = [];
|
|
49482
|
+
const { tieFormatName = COLLEGE_DEFAULT$1, teamProfiles = [], teamsCount = 0, category, idPrefix, gender, } = leagueProfile;
|
|
49483
|
+
const eventName = leagueProfile.leagueName ?? leagueProfile.eventName ?? `League ${leaguesCount + 1}`;
|
|
49484
|
+
const eventId = leagueProfile.leagueId ?? leagueProfile.eventId ?? uuids?.pop() ?? UUID();
|
|
49485
|
+
eventIds.push(eventId);
|
|
49486
|
+
const tieFormat = (isObject(leagueProfile.tieFormat) && leagueProfile.tieFormat) ||
|
|
49487
|
+
tieFormatDefaults({
|
|
49488
|
+
event: { eventId, category, gender },
|
|
49489
|
+
namedFormat: tieFormatName,
|
|
49490
|
+
isMock: params.isMock,
|
|
49491
|
+
}) ||
|
|
49492
|
+
undefined;
|
|
49493
|
+
if (!tieFormat)
|
|
49494
|
+
return { error: MISSING_TIE_FORMAT };
|
|
49495
|
+
const drawSize = Math.max(teamsCount, teamProfiles.length);
|
|
49496
|
+
const teamsRange = generateRange(0, drawSize);
|
|
49497
|
+
const { genders, teamSize } = processTieFormat({ tieFormat, drawSize });
|
|
49498
|
+
const gendersCount = { [FEMALE]: 0, [MIXED]: 0, [OTHER$2]: 0, [MALE]: 0, [ANY]: 0 };
|
|
49499
|
+
Object.keys(genders).forEach((key) => (gendersCount[key] += genders[key]));
|
|
49500
|
+
for (const index of teamsRange) {
|
|
49501
|
+
const teamName = teamProfiles?.[index]?.teamName ?? `Team ${index + 1}`;
|
|
49502
|
+
const teamId = teamProfiles?.[index]?.teamId || uuids?.pop() || UUID();
|
|
49503
|
+
const consideredDate = leagueProfile.startDate ?? params.startDate;
|
|
49504
|
+
const participants = generateParticipants({
|
|
49505
|
+
...leagueProfile?.participantsProfile,
|
|
49506
|
+
participantsCount: teamSize,
|
|
49507
|
+
consideredDate,
|
|
49508
|
+
gendersCount,
|
|
49509
|
+
category,
|
|
49510
|
+
gender,
|
|
49511
|
+
uuids,
|
|
49512
|
+
}).participants;
|
|
49513
|
+
const individualParticipantIds = participants.map((participant) => participant.participantId);
|
|
49514
|
+
const participantType = TEAM;
|
|
49515
|
+
const teamParticipantId = teamId ??
|
|
49516
|
+
genParticipantId({
|
|
49517
|
+
participantType,
|
|
49518
|
+
idPrefix,
|
|
49519
|
+
index,
|
|
49520
|
+
uuids,
|
|
49521
|
+
});
|
|
49522
|
+
entries.push({ participantId: teamParticipantId, entryStatus: DIRECT_ACCEPTANCE, entryStage: MAIN });
|
|
49523
|
+
const homeVenueIds = teamProfiles?.[index]?.venueIds ?? [];
|
|
49524
|
+
const teamParticipant = {
|
|
49525
|
+
participantId: teamParticipantId,
|
|
49526
|
+
participantRole: COMPETITOR,
|
|
49527
|
+
participantName: teamName,
|
|
49528
|
+
individualParticipantIds,
|
|
49529
|
+
participantType,
|
|
49530
|
+
homeVenueIds,
|
|
49531
|
+
};
|
|
49532
|
+
homeVenueIds.forEach((venueId) => !venueIds.includes(venueId) && venueIds.push(venueId));
|
|
49533
|
+
allUniqueParticipantIds.push(...individualParticipantIds);
|
|
49534
|
+
allUniqueParticipantIds.push(teamParticipantId);
|
|
49535
|
+
const result = addParticipants({
|
|
49536
|
+
participants: [teamParticipant, ...participants],
|
|
49537
|
+
tournamentRecord,
|
|
49538
|
+
});
|
|
49539
|
+
if (result.error)
|
|
49540
|
+
return result;
|
|
49541
|
+
}
|
|
49542
|
+
const eventType = TEAM;
|
|
49543
|
+
const event = { eventName, entries, eventType, tieFormat, category, eventId, gender };
|
|
49544
|
+
if (!tournamentRecord.events)
|
|
49545
|
+
tournamentRecord.events = [];
|
|
49546
|
+
tournamentRecord.events.push(event);
|
|
49547
|
+
if (entries.length) {
|
|
49548
|
+
const roundsCount = isNumeric(leagueProfile.roundsCount)
|
|
49549
|
+
? leagueProfile.roundsCount
|
|
49550
|
+
: leagueProfile.roundsCount === DOUBLE_ROUND_ROBIN
|
|
49551
|
+
? (drawSize - 1) * 2
|
|
49552
|
+
: drawSize - 1;
|
|
49553
|
+
const result = generateDrawDefinition({
|
|
49554
|
+
automated: leagueProfile.automated,
|
|
49555
|
+
tournamentRecord,
|
|
49556
|
+
drawType: AD_HOC,
|
|
49557
|
+
roundsCount,
|
|
49558
|
+
drawSize,
|
|
49559
|
+
event,
|
|
49560
|
+
});
|
|
49561
|
+
if (result.error)
|
|
49562
|
+
return result;
|
|
49563
|
+
const { drawDefinition } = result;
|
|
49564
|
+
if (drawDefinition) {
|
|
49565
|
+
const drawId = drawDefinition?.drawId;
|
|
49566
|
+
addDrawDefinition({ drawDefinition, event, suppressNotifications: true });
|
|
49567
|
+
drawIds.push(drawId);
|
|
49568
|
+
}
|
|
49569
|
+
}
|
|
49570
|
+
leaguesCount++;
|
|
49571
|
+
}
|
|
49572
|
+
const venueProfiles = venueIds.map((venueId) => ({ venueId }));
|
|
49573
|
+
generateVenues({ tournamentRecord, ignoreExistingVenues: true, venueProfiles, uuids });
|
|
49574
|
+
}
|
|
49575
|
+
|
|
49396
49576
|
const mockTournamentNames = [
|
|
49397
|
-
'Mock Tournament',
|
|
49398
|
-
'CourtHive Challenge',
|
|
49399
|
-
'Racket Rally',
|
|
49400
49577
|
'Generated Tournament',
|
|
49401
|
-
'
|
|
49578
|
+
'CourtHive Challenge',
|
|
49402
49579
|
'Open Competition',
|
|
49580
|
+
'Factory Follies',
|
|
49581
|
+
'Mock Tournament',
|
|
49582
|
+
'Racket Rally',
|
|
49403
49583
|
];
|
|
49404
49584
|
function generateTournamentRecord(params) {
|
|
49405
|
-
let {
|
|
49406
|
-
const { tournamentName = randomPop(mockTournamentNames), ratingsParameters: ratingsParameters$1 = ratingsParameters,
|
|
49585
|
+
let { startDate, endDate } = params ?? {};
|
|
49586
|
+
const { tournamentName = randomPop(mockTournamentNames), ratingsParameters: ratingsParameters$1 = ratingsParameters, tournamentExtensions, policyDefinitions, schedulingProfile, venueProfiles, uuids, } = params ?? {};
|
|
49407
49587
|
if ((startDate && !isValidDateString(startDate)) || (endDate && !isValidDateString(endDate)))
|
|
49408
49588
|
return { error: INVALID_DATE };
|
|
49409
|
-
if (
|
|
49589
|
+
if ((params.leagueProfiles && !Array.isArray(params.leagueProfiles)) ||
|
|
49590
|
+
(params.eventProfiles && !Array.isArray(params.eventProfiles)) ||
|
|
49591
|
+
(params.drawProfiles && !Array.isArray(params.drawProfiles)))
|
|
49410
49592
|
return { error: INVALID_VALUES };
|
|
49411
49593
|
if (!startDate) {
|
|
49412
49594
|
const tournamentDate = new Date();
|
|
@@ -49417,15 +49599,14 @@ function generateTournamentRecord(params) {
|
|
|
49417
49599
|
const tournamentDate = new Date(startDate);
|
|
49418
49600
|
endDate = formatDate(tournamentDate.setDate(tournamentDate.getDate() + 7));
|
|
49419
49601
|
}
|
|
49420
|
-
if (typeof tournamentAttributes !== 'object')
|
|
49421
|
-
tournamentAttributes = {};
|
|
49422
49602
|
const tournamentRecord = newTournamentRecord({
|
|
49423
|
-
...tournamentAttributes,
|
|
49603
|
+
...(params.tournamentAttributes ?? {}),
|
|
49424
49604
|
tournamentName,
|
|
49425
49605
|
isMock: true,
|
|
49426
49606
|
startDate,
|
|
49427
49607
|
endDate,
|
|
49428
49608
|
});
|
|
49609
|
+
const venueIds = venueProfiles?.length ? generateVenues({ tournamentRecord, venueProfiles, uuids }) : [];
|
|
49429
49610
|
if (tournamentExtensions?.length && Array.isArray(tournamentExtensions)) {
|
|
49430
49611
|
const extensions = tournamentExtensions.filter((extension) => isValidExtension({ extension }));
|
|
49431
49612
|
if (extensions?.length)
|
|
@@ -49439,105 +49620,57 @@ function generateTournamentRecord(params) {
|
|
|
49439
49620
|
});
|
|
49440
49621
|
}
|
|
49441
49622
|
}
|
|
49442
|
-
|
|
49443
|
-
|
|
49444
|
-
|
|
49445
|
-
|
|
49446
|
-
|
|
49447
|
-
|
|
49448
|
-
|
|
49449
|
-
|
|
49450
|
-
|
|
49451
|
-
|
|
49623
|
+
if (!params?.leagueProfiles?.length ||
|
|
49624
|
+
params.eventProfiles?.length ||
|
|
49625
|
+
params.drawProfiles?.length ||
|
|
49626
|
+
params.participantsProfile) {
|
|
49627
|
+
const result = addTournamentParticipants({
|
|
49628
|
+
tournamentRecord,
|
|
49629
|
+
...params,
|
|
49630
|
+
});
|
|
49631
|
+
if (!result.success)
|
|
49632
|
+
return result;
|
|
49633
|
+
}
|
|
49452
49634
|
const allUniqueParticipantIds = [], eventIds = [], drawIds = [];
|
|
49453
|
-
if (
|
|
49454
|
-
|
|
49455
|
-
|
|
49456
|
-
|
|
49457
|
-
|
|
49458
|
-
|
|
49459
|
-
|
|
49460
|
-
|
|
49461
|
-
|
|
49462
|
-
|
|
49463
|
-
|
|
49464
|
-
ratingsParameters: ratingsParameters$1,
|
|
49465
|
-
tournamentRecord,
|
|
49466
|
-
isMock: true,
|
|
49467
|
-
drawProfile,
|
|
49468
|
-
startDate,
|
|
49469
|
-
drawIndex,
|
|
49470
|
-
uuids,
|
|
49471
|
-
});
|
|
49472
|
-
if (result.error)
|
|
49473
|
-
return result;
|
|
49474
|
-
const { drawId, eventId, event, uniqueParticipantIds } = result;
|
|
49475
|
-
result = addEvent({
|
|
49476
|
-
suppressNotifications: false,
|
|
49477
|
-
internalUse: true,
|
|
49478
|
-
tournamentRecord,
|
|
49479
|
-
event,
|
|
49480
|
-
});
|
|
49481
|
-
if (result.error)
|
|
49482
|
-
return result;
|
|
49483
|
-
if (drawId)
|
|
49484
|
-
drawIds.push(drawId);
|
|
49485
|
-
eventIds.push(eventId);
|
|
49486
|
-
if (uniqueParticipantIds?.length)
|
|
49487
|
-
allUniqueParticipantIds.push(...uniqueParticipantIds);
|
|
49488
|
-
drawIndex += 1;
|
|
49489
|
-
}
|
|
49635
|
+
if (params.leagueProfiles) {
|
|
49636
|
+
const result = processLeagueProfiles({
|
|
49637
|
+
allUniqueParticipantIds,
|
|
49638
|
+
tournamentRecord,
|
|
49639
|
+
...params,
|
|
49640
|
+
eventIds,
|
|
49641
|
+
venueIds,
|
|
49642
|
+
drawIds,
|
|
49643
|
+
});
|
|
49644
|
+
if (result?.error)
|
|
49645
|
+
return result;
|
|
49490
49646
|
}
|
|
49491
|
-
if (
|
|
49492
|
-
|
|
49493
|
-
|
|
49494
|
-
|
|
49495
|
-
|
|
49496
|
-
|
|
49497
|
-
|
|
49498
|
-
|
|
49499
|
-
|
|
49500
|
-
|
|
49501
|
-
|
|
49502
|
-
ratingsParameters: ratingsParameters$1,
|
|
49503
|
-
tournamentRecord,
|
|
49504
|
-
eventProfile,
|
|
49505
|
-
eventIndex,
|
|
49506
|
-
startDate,
|
|
49507
|
-
uuids,
|
|
49508
|
-
});
|
|
49509
|
-
if (result.error)
|
|
49510
|
-
return result;
|
|
49511
|
-
const { eventId, drawIds: generatedDrawIds, uniqueParticipantIds } = result;
|
|
49512
|
-
if (generatedDrawIds)
|
|
49513
|
-
drawIds.push(...generatedDrawIds);
|
|
49514
|
-
eventIds.push(eventId);
|
|
49515
|
-
if (uniqueParticipantIds?.length)
|
|
49516
|
-
allUniqueParticipantIds.push(...uniqueParticipantIds);
|
|
49517
|
-
eventIndex += 1;
|
|
49518
|
-
}
|
|
49647
|
+
if (params.drawProfiles) {
|
|
49648
|
+
const result = processDrawProfiles({
|
|
49649
|
+
allUniqueParticipantIds,
|
|
49650
|
+
ratingsParameters: ratingsParameters$1,
|
|
49651
|
+
tournamentRecord,
|
|
49652
|
+
...params,
|
|
49653
|
+
eventIds,
|
|
49654
|
+
drawIds,
|
|
49655
|
+
});
|
|
49656
|
+
if (result?.error)
|
|
49657
|
+
return result;
|
|
49519
49658
|
}
|
|
49520
|
-
|
|
49521
|
-
|
|
49522
|
-
|
|
49523
|
-
|
|
49524
|
-
const result = generateScheduledRounds({
|
|
49525
|
-
schedulingProfile,
|
|
49659
|
+
if (params.eventProfiles) {
|
|
49660
|
+
const result = processEventProfiles({
|
|
49661
|
+
allUniqueParticipantIds,
|
|
49662
|
+
ratingsParameters: ratingsParameters$1,
|
|
49526
49663
|
tournamentRecord,
|
|
49664
|
+
...params,
|
|
49665
|
+
eventIds,
|
|
49666
|
+
drawIds,
|
|
49527
49667
|
});
|
|
49528
|
-
if (result
|
|
49668
|
+
if (result?.error)
|
|
49529
49669
|
return result;
|
|
49530
|
-
scheduledRounds = result.scheduledRounds;
|
|
49531
|
-
if (autoSchedule) {
|
|
49532
|
-
const { tournamentId } = tournamentRecord;
|
|
49533
|
-
const tournamentRecords = { [tournamentId]: tournamentRecord };
|
|
49534
|
-
schedulerResult = scheduleProfileRounds({
|
|
49535
|
-
scheduleCompletedMatchUps,
|
|
49536
|
-
tournamentRecords,
|
|
49537
|
-
periodLength,
|
|
49538
|
-
});
|
|
49539
|
-
}
|
|
49540
49670
|
}
|
|
49671
|
+
const { scheduledRounds = undefined, schedulerResult = {} } = schedulingProfile
|
|
49672
|
+
? scheduleRounds({ ...params, tournamentRecord })
|
|
49673
|
+
: {};
|
|
49541
49674
|
cycleMutationStatus();
|
|
49542
49675
|
return definedAttributes({
|
|
49543
49676
|
...SUCCESS,
|
|
@@ -49549,6 +49682,73 @@ function generateTournamentRecord(params) {
|
|
|
49549
49682
|
drawIds,
|
|
49550
49683
|
});
|
|
49551
49684
|
}
|
|
49685
|
+
function processDrawProfiles(params) {
|
|
49686
|
+
const { tournamentRecord, drawProfiles, allUniqueParticipantIds, eventIds, drawIds } = params;
|
|
49687
|
+
let drawIndex = 0;
|
|
49688
|
+
for (const drawProfile of drawProfiles) {
|
|
49689
|
+
let result = generateEventWithDraw({
|
|
49690
|
+
allUniqueParticipantIds,
|
|
49691
|
+
tournamentRecord,
|
|
49692
|
+
drawProfile,
|
|
49693
|
+
drawIndex,
|
|
49694
|
+
...params,
|
|
49695
|
+
});
|
|
49696
|
+
if (result.error)
|
|
49697
|
+
return result;
|
|
49698
|
+
const { drawId, eventId, event, uniqueParticipantIds } = result;
|
|
49699
|
+
result = addEvent({
|
|
49700
|
+
suppressNotifications: false,
|
|
49701
|
+
internalUse: true,
|
|
49702
|
+
tournamentRecord,
|
|
49703
|
+
event,
|
|
49704
|
+
});
|
|
49705
|
+
if (result.error)
|
|
49706
|
+
return result;
|
|
49707
|
+
if (drawId)
|
|
49708
|
+
drawIds.push(drawId);
|
|
49709
|
+
eventIds.push(eventId);
|
|
49710
|
+
if (uniqueParticipantIds?.length)
|
|
49711
|
+
allUniqueParticipantIds.push(...uniqueParticipantIds);
|
|
49712
|
+
drawIndex += 1;
|
|
49713
|
+
}
|
|
49714
|
+
}
|
|
49715
|
+
function processEventProfiles(params) {
|
|
49716
|
+
const { eventProfiles, allUniqueParticipantIds, eventIds, drawIds } = params;
|
|
49717
|
+
let eventIndex = 0;
|
|
49718
|
+
for (const eventProfile of eventProfiles) {
|
|
49719
|
+
const result = generateEventWithFlights({ ...params, eventIndex, eventProfile });
|
|
49720
|
+
if (result.error)
|
|
49721
|
+
return result;
|
|
49722
|
+
const { eventId, drawIds: generatedDrawIds, uniqueParticipantIds } = result;
|
|
49723
|
+
if (generatedDrawIds)
|
|
49724
|
+
drawIds.push(...generatedDrawIds);
|
|
49725
|
+
eventIds.push(eventId);
|
|
49726
|
+
if (uniqueParticipantIds?.length)
|
|
49727
|
+
allUniqueParticipantIds.push(...uniqueParticipantIds);
|
|
49728
|
+
eventIndex += 1;
|
|
49729
|
+
}
|
|
49730
|
+
}
|
|
49731
|
+
function scheduleRounds(params) {
|
|
49732
|
+
const { schedulingProfile, tournamentRecord, autoSchedule, periodLength, scheduleCompletedMatchUps } = params;
|
|
49733
|
+
const result = generateScheduledRounds({
|
|
49734
|
+
schedulingProfile,
|
|
49735
|
+
tournamentRecord,
|
|
49736
|
+
});
|
|
49737
|
+
if (result.error)
|
|
49738
|
+
return result;
|
|
49739
|
+
const scheduledRounds = result.scheduledRounds;
|
|
49740
|
+
if (autoSchedule) {
|
|
49741
|
+
const { tournamentId } = tournamentRecord;
|
|
49742
|
+
const tournamentRecords = { [tournamentId]: tournamentRecord };
|
|
49743
|
+
const schedulerResult = scheduleProfileRounds({
|
|
49744
|
+
scheduleCompletedMatchUps,
|
|
49745
|
+
tournamentRecords,
|
|
49746
|
+
periodLength,
|
|
49747
|
+
});
|
|
49748
|
+
return { schedulerResult, scheduledRounds };
|
|
49749
|
+
}
|
|
49750
|
+
return { scheduledRounds };
|
|
49751
|
+
}
|
|
49552
49752
|
|
|
49553
49753
|
var generate$1 = {
|
|
49554
49754
|
__proto__: null,
|
|
@@ -51944,7 +52144,7 @@ function getStructureReports({ firstFlightOnly = true, extensionProfiles, tourna
|
|
|
51944
52144
|
};
|
|
51945
52145
|
}
|
|
51946
52146
|
function getPositionManipulations({ extensions }) {
|
|
51947
|
-
return extensions?.find(({ name }) => name ===
|
|
52147
|
+
return extensions?.find(({ name }) => name === POSITION_ACTIONS)?.value?.slice(1);
|
|
51948
52148
|
}
|
|
51949
52149
|
|
|
51950
52150
|
function getVenuesReport({ ignoreDisabled = true, tournamentRecords, tournamentId, venueIds = [], dates = [], }) {
|
|
@@ -53119,8 +53319,8 @@ function setMatchUpDailyLimits(params) {
|
|
|
53119
53319
|
for (const currentTournamentId of tournamentIds) {
|
|
53120
53320
|
const tournamentRecord = tournamentRecords[currentTournamentId];
|
|
53121
53321
|
const result = addExtension({
|
|
53122
|
-
element: tournamentRecord,
|
|
53123
53322
|
extension: { name: SCHEDULE_LIMITS, value: { dailyLimits } },
|
|
53323
|
+
element: tournamentRecord,
|
|
53124
53324
|
});
|
|
53125
53325
|
if (result.error)
|
|
53126
53326
|
return result;
|
|
@@ -53166,6 +53366,7 @@ var mutate$3 = {
|
|
|
53166
53366
|
scheduleMatchUps: scheduleMatchUps,
|
|
53167
53367
|
scheduleProfileRounds: scheduleProfileRounds,
|
|
53168
53368
|
setMatchUpDailyLimits: setMatchUpDailyLimits,
|
|
53369
|
+
setMatchUpHomeParticipantId: setMatchUpHomeParticipantId,
|
|
53169
53370
|
setSchedulingProfile: setSchedulingProfile,
|
|
53170
53371
|
toggleParticipantCheckInState: toggleParticipantCheckInState,
|
|
53171
53372
|
validateSchedulingProfile: validateSchedulingProfile
|
|
@@ -53216,6 +53417,7 @@ var index$5 = {
|
|
|
53216
53417
|
scheduleMatchUps: scheduleMatchUps,
|
|
53217
53418
|
scheduleProfileRounds: scheduleProfileRounds,
|
|
53218
53419
|
setMatchUpDailyLimits: setMatchUpDailyLimits,
|
|
53420
|
+
setMatchUpHomeParticipantId: setMatchUpHomeParticipantId,
|
|
53219
53421
|
setSchedulingProfile: setSchedulingProfile,
|
|
53220
53422
|
toggleParticipantCheckInState: toggleParticipantCheckInState,
|
|
53221
53423
|
validateSchedulingProfile: validateSchedulingProfile
|
|
@@ -53577,14 +53779,16 @@ function getMatchUpChangesArePossible({ check, matchUp }) {
|
|
|
53577
53779
|
return { changesArePossible, changes, cannotChangeReaon };
|
|
53578
53780
|
}
|
|
53579
53781
|
|
|
53580
|
-
function tieFormatTelemetry({ drawDefinition, auditData }) {
|
|
53782
|
+
function tieFormatTelemetry({ appliedPolicies, drawDefinition, auditData }) {
|
|
53783
|
+
if (!appliedPolicies?.audit?.[TIE_FORMAT_MODIFICATIONS])
|
|
53784
|
+
return;
|
|
53581
53785
|
const { extension } = findExtension({
|
|
53582
53786
|
name: TIE_FORMAT_MODIFICATIONS,
|
|
53583
53787
|
element: drawDefinition,
|
|
53584
53788
|
});
|
|
53585
53789
|
const updatedExtension = {
|
|
53586
|
-
name: TIE_FORMAT_MODIFICATIONS,
|
|
53587
53790
|
value: Array.isArray(extension?.value) ? extension?.value.concat(auditData) : [auditData],
|
|
53791
|
+
name: TIE_FORMAT_MODIFICATIONS,
|
|
53588
53792
|
};
|
|
53589
53793
|
addExtension({ element: drawDefinition, extension: updatedExtension });
|
|
53590
53794
|
}
|
|
@@ -53790,17 +53994,15 @@ function modifyCollectionDefinition({ updateInProgressMatchUps = false, tourname
|
|
|
53790
53994
|
});
|
|
53791
53995
|
if (!result.error) {
|
|
53792
53996
|
const { appliedPolicies } = getAppliedPolicies({ tournamentRecord });
|
|
53793
|
-
|
|
53794
|
-
|
|
53795
|
-
|
|
53796
|
-
|
|
53797
|
-
|
|
53798
|
-
|
|
53799
|
-
|
|
53800
|
-
|
|
53801
|
-
|
|
53802
|
-
tieFormatTelemetry({ drawDefinition, auditData });
|
|
53803
|
-
}
|
|
53997
|
+
const auditData = definedAttributes({
|
|
53998
|
+
collectionDefinition: targetCollectionDefinition,
|
|
53999
|
+
drawId: drawDefinition?.drawId,
|
|
54000
|
+
action: stack,
|
|
54001
|
+
structureId,
|
|
54002
|
+
matchUpId,
|
|
54003
|
+
eventId,
|
|
54004
|
+
});
|
|
54005
|
+
tieFormatTelemetry({ appliedPolicies, drawDefinition, auditData });
|
|
53804
54006
|
}
|
|
53805
54007
|
return decorateResult({ result: { ...result, modifications }, stack });
|
|
53806
54008
|
}
|
|
@@ -53969,17 +54171,15 @@ function removeCollectionGroup({ updateInProgressMatchUps = true, collectionGrou
|
|
|
53969
54171
|
});
|
|
53970
54172
|
if (!result.error) {
|
|
53971
54173
|
const { appliedPolicies } = getAppliedPolicies({ tournamentRecord });
|
|
53972
|
-
|
|
53973
|
-
|
|
53974
|
-
|
|
53975
|
-
|
|
53976
|
-
|
|
53977
|
-
|
|
53978
|
-
|
|
53979
|
-
|
|
53980
|
-
|
|
53981
|
-
tieFormatTelemetry({ drawDefinition, auditData });
|
|
53982
|
-
}
|
|
54174
|
+
const auditData = definedAttributes({
|
|
54175
|
+
drawId: drawDefinition?.drawId,
|
|
54176
|
+
collectionGroupNumber,
|
|
54177
|
+
action: stack,
|
|
54178
|
+
structureId,
|
|
54179
|
+
matchUpId,
|
|
54180
|
+
eventId,
|
|
54181
|
+
});
|
|
54182
|
+
tieFormatTelemetry({ appliedPolicies, drawDefinition, auditData });
|
|
53983
54183
|
}
|
|
53984
54184
|
return decorateResult({
|
|
53985
54185
|
result: { ...result, modifiedCollectionIds },
|
|
@@ -54322,17 +54522,15 @@ function removeCollectionDefinition({ updateInProgressMatchUps = true, tieFormat
|
|
|
54322
54522
|
return { error: MISSING_DRAW_DEFINITION };
|
|
54323
54523
|
}
|
|
54324
54524
|
modifyDrawNotice({ drawDefinition, eventId: event?.eventId });
|
|
54325
|
-
|
|
54326
|
-
|
|
54327
|
-
|
|
54328
|
-
|
|
54329
|
-
|
|
54330
|
-
|
|
54331
|
-
|
|
54332
|
-
|
|
54333
|
-
|
|
54334
|
-
tieFormatTelemetry({ drawDefinition, auditData });
|
|
54335
|
-
}
|
|
54525
|
+
const auditData = definedAttributes({
|
|
54526
|
+
drawId: drawDefinition?.drawId,
|
|
54527
|
+
action: stack,
|
|
54528
|
+
collectionId,
|
|
54529
|
+
structureId,
|
|
54530
|
+
matchUpId,
|
|
54531
|
+
eventId,
|
|
54532
|
+
});
|
|
54533
|
+
tieFormatTelemetry({ appliedPolicies, drawDefinition, auditData });
|
|
54336
54534
|
return {
|
|
54337
54535
|
tieFormat: prunedTieFormat,
|
|
54338
54536
|
deletedMatchUpIds,
|
|
@@ -54578,17 +54776,15 @@ function addCollectionDefinition({ updateInProgressMatchUps = true, collectionDe
|
|
|
54578
54776
|
else {
|
|
54579
54777
|
return { error: MISSING_DRAW_DEFINITION };
|
|
54580
54778
|
}
|
|
54581
|
-
|
|
54582
|
-
|
|
54583
|
-
|
|
54584
|
-
|
|
54585
|
-
|
|
54586
|
-
|
|
54587
|
-
|
|
54588
|
-
|
|
54589
|
-
|
|
54590
|
-
tieFormatTelemetry({ drawDefinition, auditData });
|
|
54591
|
-
}
|
|
54779
|
+
const auditData = definedAttributes({
|
|
54780
|
+
drawId: drawDefinition?.drawId,
|
|
54781
|
+
collectionDefinition,
|
|
54782
|
+
action: stack,
|
|
54783
|
+
structureId,
|
|
54784
|
+
matchUpId,
|
|
54785
|
+
eventId,
|
|
54786
|
+
});
|
|
54787
|
+
tieFormatTelemetry({ appliedPolicies, drawDefinition, auditData });
|
|
54592
54788
|
return {
|
|
54593
54789
|
tieFormat: prunedTieFormat,
|
|
54594
54790
|
targetMatchUps,
|
|
@@ -55041,9 +55237,9 @@ function setTournamentDates(params) {
|
|
|
55041
55237
|
const paramsCheck = checkRequiredParameters(params, [
|
|
55042
55238
|
{ tournamentRecord: true },
|
|
55043
55239
|
{
|
|
55240
|
+
[VALIDATE]: (value) => dateValidation.test(value),
|
|
55044
55241
|
[ANY_OF]: { startDate: false, endDate: false },
|
|
55045
55242
|
[INVALID]: INVALID_DATE,
|
|
55046
|
-
[VALIDATE]: (value) => dateValidation.test(value),
|
|
55047
55243
|
},
|
|
55048
55244
|
]);
|
|
55049
55245
|
if (paramsCheck.error)
|