tods-competition-factory 0.88.2 → 0.89.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/tods-competition-factory.development.cjs.js +352 -201
- package/dist/tods-competition-factory.development.cjs.js.map +1 -1
- package/dist/tods-competition-factory.production.cjs.min.js +1 -1
- package/dist/tods-competition-factory.production.cjs.min.js.map +1 -1
- package/dist/tods-competition-factory.production.esm.min.js +1 -1
- package/dist/tods-competition-factory.production.esm.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -249,7 +249,7 @@ const matchUpFormatCode = {
|
|
|
249
249
|
};
|
|
250
250
|
|
|
251
251
|
function factoryVersion() {
|
|
252
|
-
return '0.
|
|
252
|
+
return '0.89.0';
|
|
253
253
|
}
|
|
254
254
|
|
|
255
255
|
const FORMAT_STANDARD = 'SET3-S:6/TB7'; // Best of 3 Tiebreak Sets to 6
|
|
@@ -2453,7 +2453,6 @@ const SEEDING$1 = 'SEEDING'; // 'SCALE.SEEDING'
|
|
|
2453
2453
|
|
|
2454
2454
|
const PUBLISH = 'PUBLISH';
|
|
2455
2455
|
const PUBLIC = 'PUBLIC';
|
|
2456
|
-
const HIDDEN = 'HIDDEN';
|
|
2457
2456
|
const STATUS$1 = 'STATUS';
|
|
2458
2457
|
const RETRIEVAL = 'RETRIEVAL';
|
|
2459
2458
|
const OTHER$3 = 'other';
|
|
@@ -2464,7 +2463,6 @@ const timeItemConstants = {
|
|
|
2464
2463
|
CHECK_IN,
|
|
2465
2464
|
CHECK_OUT,
|
|
2466
2465
|
END_TIME,
|
|
2467
|
-
HIDDEN,
|
|
2468
2466
|
MEDICAL: MEDICAL$1,
|
|
2469
2467
|
OTHER: OTHER$3,
|
|
2470
2468
|
PENALTY: PENALTY$1,
|
|
@@ -9585,6 +9583,8 @@ const MODIFY_PARTICIPANTS = 'modifyParticipants';
|
|
|
9585
9583
|
const MODIFY_VENUE = 'modifyVenue';
|
|
9586
9584
|
const PUBLISH_EVENT = 'publishEvent';
|
|
9587
9585
|
const UNPUBLISH_EVENT = 'unPublishEvent';
|
|
9586
|
+
const PUBLISH_EVENT_SEEDING = 'publishEventSeeding';
|
|
9587
|
+
const UNPUBLISH_EVENT_SEEDING = 'unPublishEventSeeding';
|
|
9588
9588
|
const topicConstants = {
|
|
9589
9589
|
ADD_DRAW_DEFINITION,
|
|
9590
9590
|
ADD_MATCHUPS,
|
|
@@ -9599,7 +9599,10 @@ const topicConstants = {
|
|
|
9599
9599
|
MODIFY_MATCHUP,
|
|
9600
9600
|
MODIFY_PARTICIPANTS,
|
|
9601
9601
|
MODIFY_VENUE,
|
|
9602
|
-
PUBLISH_EVENT
|
|
9602
|
+
PUBLISH_EVENT,
|
|
9603
|
+
UNPUBLISH_EVENT,
|
|
9604
|
+
PUBLISH_EVENT_SEEDING,
|
|
9605
|
+
UNPUBLISH_EVENT_SEEDING
|
|
9603
9606
|
};
|
|
9604
9607
|
|
|
9605
9608
|
function drawUpdatedAt(drawDefinition, structureIds) {
|
|
@@ -22701,17 +22704,6 @@ function getRelevantParticipantIdsMap({
|
|
|
22701
22704
|
};
|
|
22702
22705
|
}
|
|
22703
22706
|
|
|
22704
|
-
const SCALE = 'SCALE';
|
|
22705
|
-
const RATING = 'RATING';
|
|
22706
|
-
const RANKING = 'RANKING';
|
|
22707
|
-
const SEEDING = 'SEEDING';
|
|
22708
|
-
const scaleConstants = {
|
|
22709
|
-
SCALE,
|
|
22710
|
-
RATING,
|
|
22711
|
-
RANKING,
|
|
22712
|
-
SEEDING
|
|
22713
|
-
};
|
|
22714
|
-
|
|
22715
22707
|
function getAccessorValue({
|
|
22716
22708
|
element,
|
|
22717
22709
|
accessor
|
|
@@ -22777,6 +22769,17 @@ function getAccessorValue({
|
|
|
22777
22769
|
}
|
|
22778
22770
|
}
|
|
22779
22771
|
|
|
22772
|
+
const SCALE = 'SCALE';
|
|
22773
|
+
const RATING = 'RATING';
|
|
22774
|
+
const RANKING = 'RANKING';
|
|
22775
|
+
const SEEDING = 'SEEDING';
|
|
22776
|
+
const scaleConstants = {
|
|
22777
|
+
SCALE,
|
|
22778
|
+
RATING,
|
|
22779
|
+
RANKING,
|
|
22780
|
+
SEEDING
|
|
22781
|
+
};
|
|
22782
|
+
|
|
22780
22783
|
function participantScaleItem({
|
|
22781
22784
|
requireTimeStamp,
|
|
22782
22785
|
scaleAttributes,
|
|
@@ -22959,18 +22962,14 @@ function addParticipantContext(params) {
|
|
|
22959
22962
|
});
|
|
22960
22963
|
|
|
22961
22964
|
if (timeItem !== null && timeItem !== void 0 && (_timeItem$itemValue = timeItem.itemValue) !== null && _timeItem$itemValue !== void 0 && _timeItem$itemValue.PUBLIC) {
|
|
22962
|
-
var _timeItem$itemValue2;
|
|
22963
|
-
|
|
22964
22965
|
const {
|
|
22965
22966
|
drawIds: publishedDrawIds = [],
|
|
22966
22967
|
seeding
|
|
22967
|
-
} =
|
|
22968
|
+
} = timeItem.itemValue.PUBLIC || {};
|
|
22968
22969
|
const publishedSeeding = {
|
|
22969
|
-
|
|
22970
|
+
published: undefined,
|
|
22970
22971
|
// seeding can be present for all entries in an event when no flights have been defined
|
|
22971
|
-
drawIds: []
|
|
22972
|
-
// seeding can be specific to drawIds
|
|
22973
|
-
stages: [] // seeding can be specific to { stageSequence: 1 } for each stage
|
|
22972
|
+
drawIds: [] // seeding can be specific to drawIds
|
|
22974
22973
|
|
|
22975
22974
|
};
|
|
22976
22975
|
if (seeding) Object.assign(publishedSeeding, timeItem.itemValue.PUBLIC.seeding);
|
|
@@ -23141,8 +23140,9 @@ function addParticipantContext(params) {
|
|
|
23141
23140
|
scheduleConflicts,
|
|
23142
23141
|
scheduleItems
|
|
23143
23142
|
} = annotateParticipant({ ...params,
|
|
23144
|
-
|
|
23145
|
-
participantIdMap
|
|
23143
|
+
eventsPublishStatuses,
|
|
23144
|
+
participantIdMap,
|
|
23145
|
+
participant
|
|
23146
23146
|
});
|
|
23147
23147
|
|
|
23148
23148
|
if (params.withSignInStatus) {
|
|
@@ -23424,10 +23424,12 @@ function addParticipantContext(params) {
|
|
|
23424
23424
|
}
|
|
23425
23425
|
|
|
23426
23426
|
function annotateParticipant({
|
|
23427
|
+
eventsPublishStatuses,
|
|
23427
23428
|
withEvents = true,
|
|
23428
23429
|
withDraws = true,
|
|
23429
23430
|
participantIdMap,
|
|
23430
23431
|
scheduleAnalysis,
|
|
23432
|
+
usePublishState,
|
|
23431
23433
|
withStatistics,
|
|
23432
23434
|
withOpponents,
|
|
23433
23435
|
withMatchUps,
|
|
@@ -23505,6 +23507,7 @@ function annotateParticipant({
|
|
|
23505
23507
|
categoryName,
|
|
23506
23508
|
ageCategoryCode
|
|
23507
23509
|
} = (event === null || event === void 0 ? void 0 : event.category) || {};
|
|
23510
|
+
let seedValue;
|
|
23508
23511
|
let result = participantScaleItem({
|
|
23509
23512
|
scaleAttributes: {
|
|
23510
23513
|
scaleType: SEEDING,
|
|
@@ -23515,7 +23518,7 @@ function annotateParticipant({
|
|
|
23515
23518
|
});
|
|
23516
23519
|
|
|
23517
23520
|
if ((_result = result) !== null && _result !== void 0 && _result.scaleItem) {
|
|
23518
|
-
|
|
23521
|
+
seedValue = result.scaleItem.scaleValue;
|
|
23519
23522
|
} else {
|
|
23520
23523
|
var _result2;
|
|
23521
23524
|
|
|
@@ -23529,7 +23532,18 @@ function annotateParticipant({
|
|
|
23529
23532
|
});
|
|
23530
23533
|
|
|
23531
23534
|
if ((_result2 = result) !== null && _result2 !== void 0 && _result2.scaleItem) {
|
|
23532
|
-
|
|
23535
|
+
seedValue = result.scaleItem.scaleValue;
|
|
23536
|
+
}
|
|
23537
|
+
}
|
|
23538
|
+
|
|
23539
|
+
if (seedValue) {
|
|
23540
|
+
var _eventsPublishStatuse, _publishedSeeding$dra, _publishedSeeding$dra2;
|
|
23541
|
+
|
|
23542
|
+
const publishedSeeding = (_eventsPublishStatuse = eventsPublishStatuses[participantDraw.eventId]) === null || _eventsPublishStatuse === void 0 ? void 0 : _eventsPublishStatuse.publishedSeeding;
|
|
23543
|
+
const seedingPublished = !usePublishState || (publishedSeeding === null || publishedSeeding === void 0 ? void 0 : publishedSeeding.published) && ((publishedSeeding === null || publishedSeeding === void 0 ? void 0 : (_publishedSeeding$dra = publishedSeeding.drawIds) === null || _publishedSeeding$dra === void 0 ? void 0 : _publishedSeeding$dra.length) === 0 || (publishedSeeding === null || publishedSeeding === void 0 ? void 0 : (_publishedSeeding$dra2 = publishedSeeding.drawIds) === null || _publishedSeeding$dra2 === void 0 ? void 0 : _publishedSeeding$dra2.includes(participantDraw.drawId)));
|
|
23544
|
+
|
|
23545
|
+
if (seedingPublished) {
|
|
23546
|
+
participantDraw.seedValue = seedValue;
|
|
23533
23547
|
}
|
|
23534
23548
|
}
|
|
23535
23549
|
}
|
|
@@ -23557,7 +23571,15 @@ function annotateParticipant({
|
|
|
23557
23571
|
} = result;
|
|
23558
23572
|
|
|
23559
23573
|
if (scaleItem) {
|
|
23560
|
-
|
|
23574
|
+
var _eventsPublishStatuse2, _publishedSeeding$dra3, _publishedSeeding$dra4;
|
|
23575
|
+
|
|
23576
|
+
const seedValue = scaleItem.scaleValue;
|
|
23577
|
+
const publishedSeeding = (_eventsPublishStatuse2 = eventsPublishStatuses[participantEvent.eventId]) === null || _eventsPublishStatuse2 === void 0 ? void 0 : _eventsPublishStatuse2.publishedSeeding;
|
|
23578
|
+
const seedingPublished = !usePublishState || (publishedSeeding === null || publishedSeeding === void 0 ? void 0 : publishedSeeding.published) && ((publishedSeeding === null || publishedSeeding === void 0 ? void 0 : (_publishedSeeding$dra3 = publishedSeeding.drawIds) === null || _publishedSeeding$dra3 === void 0 ? void 0 : _publishedSeeding$dra3.length) === 0 || (publishedSeeding === null || publishedSeeding === void 0 ? void 0 : (_publishedSeeding$dra4 = publishedSeeding.drawIds) === null || _publishedSeeding$dra4 === void 0 ? void 0 : _publishedSeeding$dra4.includes(participantEvent.drawId)));
|
|
23579
|
+
|
|
23580
|
+
if (seedingPublished) {
|
|
23581
|
+
participantEvent.seedValue = seedValue;
|
|
23582
|
+
}
|
|
23561
23583
|
}
|
|
23562
23584
|
}
|
|
23563
23585
|
}
|
|
@@ -23814,6 +23836,7 @@ function getEventEntries({
|
|
|
23814
23836
|
* @param {boolean} scheduleAnalysis - analysis of conflicts
|
|
23815
23837
|
* @param {boolean} withGroupings - include teams and groups and pairs in which individual participants appear
|
|
23816
23838
|
* @param {boolean} withOpponents - include opponent participantIds
|
|
23839
|
+
* @param {boolean} usePublishState - when hydrating participants consider publish state (currently applies to seeding)
|
|
23817
23840
|
*
|
|
23818
23841
|
*/
|
|
23819
23842
|
|
|
@@ -23825,6 +23848,7 @@ function getTournamentParticipants({
|
|
|
23825
23848
|
withScheduleItems,
|
|
23826
23849
|
tournamentRecord,
|
|
23827
23850
|
scheduleAnalysis,
|
|
23851
|
+
usePublishState,
|
|
23828
23852
|
withStatistics,
|
|
23829
23853
|
withGroupings,
|
|
23830
23854
|
withOpponents,
|
|
@@ -23880,6 +23904,7 @@ function getTournamentParticipants({
|
|
|
23880
23904
|
withSignInStatus,
|
|
23881
23905
|
tournamentRecord,
|
|
23882
23906
|
scheduleAnalysis,
|
|
23907
|
+
usePublishState,
|
|
23883
23908
|
withStatistics,
|
|
23884
23909
|
withGroupings,
|
|
23885
23910
|
withOpponents,
|
|
@@ -42275,6 +42300,253 @@ const participantGovernor = {
|
|
|
42275
42300
|
getTournamentPersons
|
|
42276
42301
|
};
|
|
42277
42302
|
|
|
42303
|
+
function unPublishEventSeeding({
|
|
42304
|
+
tournamentRecord,
|
|
42305
|
+
status = PUBLIC,
|
|
42306
|
+
event
|
|
42307
|
+
}) {
|
|
42308
|
+
if (!tournamentRecord) return {
|
|
42309
|
+
error: MISSING_TOURNAMENT_RECORD
|
|
42310
|
+
};
|
|
42311
|
+
if (!event) return {
|
|
42312
|
+
error: MISSING_EVENT
|
|
42313
|
+
};
|
|
42314
|
+
const itemType = `${PUBLISH}.${STATUS$1}`;
|
|
42315
|
+
const {
|
|
42316
|
+
timeItem
|
|
42317
|
+
} = getEventTimeItem({
|
|
42318
|
+
itemType,
|
|
42319
|
+
event
|
|
42320
|
+
});
|
|
42321
|
+
const itemValue = (timeItem === null || timeItem === void 0 ? void 0 : timeItem.itemValue) || {
|
|
42322
|
+
[status]: {}
|
|
42323
|
+
};
|
|
42324
|
+
if (itemValue[status]) delete itemValue[status].seeding;
|
|
42325
|
+
const updatedTimeItem = {
|
|
42326
|
+
itemValue,
|
|
42327
|
+
itemType
|
|
42328
|
+
};
|
|
42329
|
+
addEventTimeItem({
|
|
42330
|
+
event,
|
|
42331
|
+
timeItem: updatedTimeItem
|
|
42332
|
+
});
|
|
42333
|
+
addNotice({
|
|
42334
|
+
topic: UNPUBLISH_EVENT_SEEDING,
|
|
42335
|
+
payload: {
|
|
42336
|
+
eventId: event.eventId
|
|
42337
|
+
}
|
|
42338
|
+
});
|
|
42339
|
+
return { ...SUCCESS
|
|
42340
|
+
};
|
|
42341
|
+
}
|
|
42342
|
+
|
|
42343
|
+
function publishEventSeeding({
|
|
42344
|
+
tournamentRecord,
|
|
42345
|
+
status = PUBLIC,
|
|
42346
|
+
drawIds = [],
|
|
42347
|
+
event
|
|
42348
|
+
}) {
|
|
42349
|
+
if (!tournamentRecord) return {
|
|
42350
|
+
error: MISSING_TOURNAMENT_RECORD
|
|
42351
|
+
};
|
|
42352
|
+
if (!event) return {
|
|
42353
|
+
error: MISSING_EVENT
|
|
42354
|
+
};
|
|
42355
|
+
const itemType = `${PUBLISH}.${STATUS$1}`;
|
|
42356
|
+
const {
|
|
42357
|
+
timeItem
|
|
42358
|
+
} = getEventTimeItem({
|
|
42359
|
+
itemType,
|
|
42360
|
+
event
|
|
42361
|
+
});
|
|
42362
|
+
const itemValue = (timeItem === null || timeItem === void 0 ? void 0 : timeItem.itemValue) || {
|
|
42363
|
+
[status]: {}
|
|
42364
|
+
};
|
|
42365
|
+
itemValue[status].seeding = {
|
|
42366
|
+
published: true,
|
|
42367
|
+
drawIds
|
|
42368
|
+
};
|
|
42369
|
+
const updatedTimeItem = {
|
|
42370
|
+
itemValue,
|
|
42371
|
+
itemType
|
|
42372
|
+
};
|
|
42373
|
+
addEventTimeItem({
|
|
42374
|
+
event,
|
|
42375
|
+
timeItem: updatedTimeItem
|
|
42376
|
+
});
|
|
42377
|
+
addNotice({
|
|
42378
|
+
topic: PUBLISH_EVENT_SEEDING,
|
|
42379
|
+
payload: {
|
|
42380
|
+
eventId: event.eventId,
|
|
42381
|
+
drawIds
|
|
42382
|
+
}
|
|
42383
|
+
});
|
|
42384
|
+
return { ...SUCCESS
|
|
42385
|
+
};
|
|
42386
|
+
}
|
|
42387
|
+
|
|
42388
|
+
function getAllEventData({
|
|
42389
|
+
tournamentRecord,
|
|
42390
|
+
policyDefinitions
|
|
42391
|
+
}) {
|
|
42392
|
+
if (!tournamentRecord) return {
|
|
42393
|
+
error: MISSING_TOURNAMENT_RECORD
|
|
42394
|
+
};
|
|
42395
|
+
const events = tournamentRecord.events || [];
|
|
42396
|
+
const tournamentParticipants = (tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.participants) || [];
|
|
42397
|
+
const {
|
|
42398
|
+
tournamentInfo
|
|
42399
|
+
} = getTournamentInfo({
|
|
42400
|
+
tournamentRecord
|
|
42401
|
+
});
|
|
42402
|
+
const {
|
|
42403
|
+
venues: venuesData
|
|
42404
|
+
} = getVenuesAndCourts$1({
|
|
42405
|
+
tournamentRecord
|
|
42406
|
+
});
|
|
42407
|
+
const eventsData = events.map(event => {
|
|
42408
|
+
const {
|
|
42409
|
+
eventId
|
|
42410
|
+
} = event;
|
|
42411
|
+
|
|
42412
|
+
const eventInfo = (({
|
|
42413
|
+
eventId,
|
|
42414
|
+
eventName,
|
|
42415
|
+
eventType,
|
|
42416
|
+
eventLevel,
|
|
42417
|
+
surfaceCategory,
|
|
42418
|
+
matchUpFormat,
|
|
42419
|
+
category,
|
|
42420
|
+
gender,
|
|
42421
|
+
startDate,
|
|
42422
|
+
endDate,
|
|
42423
|
+
ballType,
|
|
42424
|
+
discipline
|
|
42425
|
+
}) => ({
|
|
42426
|
+
eventId,
|
|
42427
|
+
eventName,
|
|
42428
|
+
eventType,
|
|
42429
|
+
eventLevel,
|
|
42430
|
+
surfaceCategory,
|
|
42431
|
+
matchUpFormat,
|
|
42432
|
+
category,
|
|
42433
|
+
gender,
|
|
42434
|
+
startDate,
|
|
42435
|
+
endDate,
|
|
42436
|
+
ballType,
|
|
42437
|
+
discipline
|
|
42438
|
+
}))(event);
|
|
42439
|
+
|
|
42440
|
+
const scheduleTiming = getScheduleTiming({
|
|
42441
|
+
tournamentRecord,
|
|
42442
|
+
event
|
|
42443
|
+
}).scheduleTiming;
|
|
42444
|
+
const drawsData = (event.drawDefinitions || []).map(drawDefinition => {
|
|
42445
|
+
const drawInfo = (({
|
|
42446
|
+
drawId,
|
|
42447
|
+
drawName,
|
|
42448
|
+
matchUpFormat,
|
|
42449
|
+
updatedAt
|
|
42450
|
+
}) => ({
|
|
42451
|
+
drawId,
|
|
42452
|
+
drawName,
|
|
42453
|
+
matchUpFormat,
|
|
42454
|
+
updatedAt
|
|
42455
|
+
}))(drawDefinition);
|
|
42456
|
+
|
|
42457
|
+
const {
|
|
42458
|
+
pendingMatchUps,
|
|
42459
|
+
completedMatchUps,
|
|
42460
|
+
upcomingMatchUps,
|
|
42461
|
+
abandonedMatchUps
|
|
42462
|
+
} = getDrawMatchUps({
|
|
42463
|
+
includeByeMatchUps: false,
|
|
42464
|
+
requireParticipants: true,
|
|
42465
|
+
tournamentParticipants,
|
|
42466
|
+
context: {
|
|
42467
|
+
eventId
|
|
42468
|
+
},
|
|
42469
|
+
policyDefinitions,
|
|
42470
|
+
tournamentRecord,
|
|
42471
|
+
inContext: true,
|
|
42472
|
+
drawDefinition,
|
|
42473
|
+
scheduleTiming,
|
|
42474
|
+
event
|
|
42475
|
+
});
|
|
42476
|
+
return {
|
|
42477
|
+
drawInfo,
|
|
42478
|
+
matchUps: {
|
|
42479
|
+
abandonedMatchUps,
|
|
42480
|
+
completedMatchUps,
|
|
42481
|
+
upcomingMatchUps,
|
|
42482
|
+
pendingMatchUps
|
|
42483
|
+
}
|
|
42484
|
+
};
|
|
42485
|
+
});
|
|
42486
|
+
const {
|
|
42487
|
+
timeItem
|
|
42488
|
+
} = getEventTimeItem({
|
|
42489
|
+
event,
|
|
42490
|
+
itemType: `${PUBLISH}.${STATUS$1}`
|
|
42491
|
+
});
|
|
42492
|
+
Object.assign(eventInfo, {
|
|
42493
|
+
publish: timeItem === null || timeItem === void 0 ? void 0 : timeItem.itemValue,
|
|
42494
|
+
drawsData
|
|
42495
|
+
});
|
|
42496
|
+
return eventInfo;
|
|
42497
|
+
});
|
|
42498
|
+
const allEventData = {
|
|
42499
|
+
tournamentInfo,
|
|
42500
|
+
venuesData,
|
|
42501
|
+
eventsData
|
|
42502
|
+
};
|
|
42503
|
+
return {
|
|
42504
|
+
allEventData
|
|
42505
|
+
};
|
|
42506
|
+
}
|
|
42507
|
+
|
|
42508
|
+
function unPublishEvent({
|
|
42509
|
+
tournamentRecord,
|
|
42510
|
+
event,
|
|
42511
|
+
status = PUBLIC
|
|
42512
|
+
}) {
|
|
42513
|
+
if (!tournamentRecord) return {
|
|
42514
|
+
error: MISSING_TOURNAMENT_RECORD
|
|
42515
|
+
};
|
|
42516
|
+
if (!event) return {
|
|
42517
|
+
error: MISSING_EVENT
|
|
42518
|
+
};
|
|
42519
|
+
const itemType = `${PUBLISH}.${STATUS$1}`;
|
|
42520
|
+
const {
|
|
42521
|
+
timeItem
|
|
42522
|
+
} = getEventTimeItem({
|
|
42523
|
+
itemType,
|
|
42524
|
+
event
|
|
42525
|
+
});
|
|
42526
|
+
const itemValue = (timeItem === null || timeItem === void 0 ? void 0 : timeItem.itemValue) || {
|
|
42527
|
+
[status]: {}
|
|
42528
|
+
};
|
|
42529
|
+
delete itemValue[status].drawIds;
|
|
42530
|
+
delete itemValue[status].structureIds;
|
|
42531
|
+
const updatedTimeItem = {
|
|
42532
|
+
itemValue,
|
|
42533
|
+
itemType
|
|
42534
|
+
};
|
|
42535
|
+
addEventTimeItem({
|
|
42536
|
+
event,
|
|
42537
|
+
timeItem: updatedTimeItem
|
|
42538
|
+
});
|
|
42539
|
+
addNotice({
|
|
42540
|
+
topic: UNPUBLISH_EVENT,
|
|
42541
|
+
payload: {
|
|
42542
|
+
eventId: event.eventId
|
|
42543
|
+
}
|
|
42544
|
+
});
|
|
42545
|
+
return Object.assign({
|
|
42546
|
+
eventId: event.eventId
|
|
42547
|
+
}, SUCCESS);
|
|
42548
|
+
}
|
|
42549
|
+
|
|
42278
42550
|
function getDrawData({
|
|
42279
42551
|
tournamentParticipants = [],
|
|
42280
42552
|
policyDefinitions,
|
|
@@ -42507,8 +42779,12 @@ function getEventData({
|
|
|
42507
42779
|
participantsProfile,
|
|
42508
42780
|
policyDefinitions,
|
|
42509
42781
|
tournamentRecord,
|
|
42782
|
+
usePublishState,
|
|
42783
|
+
status = PUBLIC,
|
|
42510
42784
|
event
|
|
42511
42785
|
}) {
|
|
42786
|
+
var _timeItem$itemValue;
|
|
42787
|
+
|
|
42512
42788
|
if (!tournamentRecord) return {
|
|
42513
42789
|
error: MISSING_TOURNAMENT_RECORD
|
|
42514
42790
|
};
|
|
@@ -42522,6 +42798,13 @@ function getEventData({
|
|
|
42522
42798
|
tournamentId,
|
|
42523
42799
|
endDate
|
|
42524
42800
|
} = tournamentRecord;
|
|
42801
|
+
const {
|
|
42802
|
+
timeItem
|
|
42803
|
+
} = getEventTimeItem({
|
|
42804
|
+
itemType: `${PUBLISH}.${STATUS$1}`,
|
|
42805
|
+
event
|
|
42806
|
+
});
|
|
42807
|
+
const publishStatus = timeItem === null || timeItem === void 0 ? void 0 : (_timeItem$itemValue = timeItem.itemValue) === null || _timeItem$itemValue === void 0 ? void 0 : _timeItem$itemValue[status];
|
|
42525
42808
|
const {
|
|
42526
42809
|
tournamentParticipants
|
|
42527
42810
|
} = getTournamentParticipants({
|
|
@@ -42534,7 +42817,11 @@ function getEventData({
|
|
|
42534
42817
|
tournamentRecord
|
|
42535
42818
|
});
|
|
42536
42819
|
const drawDefinitions = event.drawDefinitions || [];
|
|
42537
|
-
const drawsData = drawDefinitions.
|
|
42820
|
+
const drawsData = drawDefinitions.filter(drawDefinition => {
|
|
42821
|
+
var _publishStatus$drawId, _publishStatus$drawId2;
|
|
42822
|
+
|
|
42823
|
+
return !usePublishState || (publishStatus === null || publishStatus === void 0 ? void 0 : (_publishStatus$drawId = publishStatus.drawIds) === null || _publishStatus$drawId === void 0 ? void 0 : _publishStatus$drawId.length) === 0 || (publishStatus === null || publishStatus === void 0 ? void 0 : (_publishStatus$drawId2 = publishStatus.drawIds) === null || _publishStatus$drawId2 === void 0 ? void 0 : _publishStatus$drawId2.includes(drawDefinition.drawId));
|
|
42824
|
+
}).map(drawDefinition => (({
|
|
42538
42825
|
drawInfo,
|
|
42539
42826
|
structures
|
|
42540
42827
|
}) => ({ ...drawInfo,
|
|
@@ -42599,12 +42886,6 @@ function getEventData({
|
|
|
42599
42886
|
venuesData,
|
|
42600
42887
|
tournamentInfo
|
|
42601
42888
|
};
|
|
42602
|
-
const {
|
|
42603
|
-
timeItem
|
|
42604
|
-
} = getEventTimeItem({
|
|
42605
|
-
event,
|
|
42606
|
-
itemType: `${PUBLISH}.${STATUS$1}`
|
|
42607
|
-
});
|
|
42608
42889
|
eventData.eventInfo.publish = {
|
|
42609
42890
|
state: timeItem === null || timeItem === void 0 ? void 0 : timeItem.itemValue,
|
|
42610
42891
|
createdAt: timeItem === null || timeItem === void 0 ? void 0 : timeItem.createdAt
|
|
@@ -42616,12 +42897,14 @@ function getEventData({
|
|
|
42616
42897
|
|
|
42617
42898
|
function publishEvent({
|
|
42618
42899
|
policyDefinitions,
|
|
42619
|
-
structureIds = [],
|
|
42620
42900
|
tournamentRecord,
|
|
42621
|
-
drawIdsToRemove,
|
|
42622
42901
|
status = PUBLIC,
|
|
42902
|
+
drawIdsToRemove,
|
|
42623
42903
|
drawIdsToAdd,
|
|
42624
42904
|
drawIds,
|
|
42905
|
+
structureIdsToRemove,
|
|
42906
|
+
structureIdsToAdd,
|
|
42907
|
+
structureIds,
|
|
42625
42908
|
event
|
|
42626
42909
|
}) {
|
|
42627
42910
|
var _event$drawDefinition, _eventData$eventInfo, _eventData$eventInfo$;
|
|
@@ -42636,43 +42919,58 @@ function publishEvent({
|
|
|
42636
42919
|
const eventDrawIds = ((_event$drawDefinition = event.drawDefinitions) === null || _event$drawDefinition === void 0 ? void 0 : _event$drawDefinition.map(({
|
|
42637
42920
|
drawId
|
|
42638
42921
|
}) => drawId)) || [];
|
|
42922
|
+
const {
|
|
42923
|
+
timeItem
|
|
42924
|
+
} = getEventTimeItem({
|
|
42925
|
+
itemType,
|
|
42926
|
+
event
|
|
42927
|
+
});
|
|
42639
42928
|
|
|
42640
42929
|
if (!drawIds && !drawIdsToAdd && !drawIdsToRemove) {
|
|
42930
|
+
// by default publish all drawIds in an event
|
|
42641
42931
|
drawIds = eventDrawIds;
|
|
42642
42932
|
} else if (!drawIds && (drawIdsToAdd !== null && drawIdsToAdd !== void 0 && drawIdsToAdd.length || drawIdsToRemove !== null && drawIdsToRemove !== void 0 && drawIdsToRemove.length)) {
|
|
42643
42933
|
var _timeItem$itemValue, _timeItem$itemValue$P;
|
|
42644
42934
|
|
|
42645
|
-
const {
|
|
42646
|
-
timeItem
|
|
42647
|
-
} = getEventTimeItem({
|
|
42648
|
-
itemType,
|
|
42649
|
-
event
|
|
42650
|
-
});
|
|
42651
42935
|
drawIds = (timeItem === null || timeItem === void 0 ? void 0 : (_timeItem$itemValue = timeItem.itemValue) === null || _timeItem$itemValue === void 0 ? void 0 : (_timeItem$itemValue$P = _timeItem$itemValue.PUBLIC) === null || _timeItem$itemValue$P === void 0 ? void 0 : _timeItem$itemValue$P.drawIds) || [];
|
|
42652
42936
|
}
|
|
42653
42937
|
|
|
42654
42938
|
drawIds = (drawIds || []).filter(drawId => !(drawIdsToRemove !== null && drawIdsToRemove !== void 0 && drawIdsToRemove.length) || !drawIdsToRemove.includes(drawId));
|
|
42655
42939
|
|
|
42656
42940
|
if (drawIdsToAdd !== null && drawIdsToAdd !== void 0 && drawIdsToAdd.length) {
|
|
42657
|
-
drawIds = unique(drawIds.concat(
|
|
42941
|
+
drawIds = unique(drawIds.concat( // ensure that only drawIds which are part of event are included
|
|
42942
|
+
...drawIdsToAdd.filter(drawId => eventDrawIds.includes(drawId))));
|
|
42658
42943
|
}
|
|
42659
42944
|
|
|
42660
|
-
|
|
42661
|
-
|
|
42945
|
+
if (!structureIds && (structureIdsToAdd !== null && structureIdsToAdd !== void 0 && structureIdsToAdd.length || structureIdsToRemove !== null && structureIdsToRemove !== void 0 && structureIdsToRemove.length)) {
|
|
42946
|
+
var _timeItem$itemValue2, _timeItem$itemValue2$;
|
|
42947
|
+
|
|
42948
|
+
structureIds = (timeItem === null || timeItem === void 0 ? void 0 : (_timeItem$itemValue2 = timeItem.itemValue) === null || _timeItem$itemValue2 === void 0 ? void 0 : (_timeItem$itemValue2$ = _timeItem$itemValue2.PUBLIC) === null || _timeItem$itemValue2$ === void 0 ? void 0 : _timeItem$itemValue2$.drawIds) || [];
|
|
42949
|
+
}
|
|
42950
|
+
|
|
42951
|
+
structureIds = (structureIds || []).filter(structureId => !(structureIdsToRemove !== null && structureIdsToRemove !== void 0 && structureIdsToRemove.length) || !structureIdsToRemove.includes(structureId));
|
|
42952
|
+
|
|
42953
|
+
if (structureIdsToAdd !== null && structureIdsToAdd !== void 0 && structureIdsToAdd.length) {
|
|
42954
|
+
structureIds = unique(structureIds.push(...structureIdsToAdd));
|
|
42955
|
+
}
|
|
42956
|
+
|
|
42957
|
+
const updatedTimeItem = {
|
|
42662
42958
|
itemValue: {
|
|
42663
42959
|
[status]: {
|
|
42664
42960
|
drawIds,
|
|
42665
42961
|
structureIds
|
|
42666
42962
|
}
|
|
42667
|
-
}
|
|
42963
|
+
},
|
|
42964
|
+
itemType
|
|
42668
42965
|
};
|
|
42669
42966
|
addEventTimeItem({
|
|
42670
42967
|
event,
|
|
42671
|
-
timeItem
|
|
42968
|
+
timeItem: updatedTimeItem
|
|
42672
42969
|
});
|
|
42673
42970
|
const {
|
|
42674
42971
|
eventData
|
|
42675
42972
|
} = getEventData({
|
|
42973
|
+
usePublishState: true,
|
|
42676
42974
|
policyDefinitions,
|
|
42677
42975
|
tournamentRecord,
|
|
42678
42976
|
event
|
|
@@ -42697,155 +42995,6 @@ function publishEvent({
|
|
|
42697
42995
|
};
|
|
42698
42996
|
}
|
|
42699
42997
|
|
|
42700
|
-
function unPublishEvent({
|
|
42701
|
-
tournamentRecord,
|
|
42702
|
-
event
|
|
42703
|
-
}) {
|
|
42704
|
-
if (!tournamentRecord) return {
|
|
42705
|
-
error: MISSING_TOURNAMENT_RECORD
|
|
42706
|
-
};
|
|
42707
|
-
if (!event) return {
|
|
42708
|
-
error: MISSING_EVENT
|
|
42709
|
-
};
|
|
42710
|
-
const timeItem = {
|
|
42711
|
-
itemType: `${PUBLISH}.${STATUS$1}`,
|
|
42712
|
-
itemValue: HIDDEN
|
|
42713
|
-
};
|
|
42714
|
-
addEventTimeItem({
|
|
42715
|
-
event,
|
|
42716
|
-
timeItem
|
|
42717
|
-
});
|
|
42718
|
-
addNotice({
|
|
42719
|
-
topic: UNPUBLISH_EVENT,
|
|
42720
|
-
payload: {
|
|
42721
|
-
eventId: event.eventId
|
|
42722
|
-
}
|
|
42723
|
-
});
|
|
42724
|
-
return Object.assign({
|
|
42725
|
-
eventId: event.eventId
|
|
42726
|
-
}, SUCCESS);
|
|
42727
|
-
}
|
|
42728
|
-
|
|
42729
|
-
function getAllEventData({
|
|
42730
|
-
tournamentRecord,
|
|
42731
|
-
policyDefinitions
|
|
42732
|
-
}) {
|
|
42733
|
-
if (!tournamentRecord) return {
|
|
42734
|
-
error: MISSING_TOURNAMENT_RECORD
|
|
42735
|
-
};
|
|
42736
|
-
const events = tournamentRecord.events || [];
|
|
42737
|
-
const tournamentParticipants = (tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.participants) || [];
|
|
42738
|
-
const {
|
|
42739
|
-
tournamentInfo
|
|
42740
|
-
} = getTournamentInfo({
|
|
42741
|
-
tournamentRecord
|
|
42742
|
-
});
|
|
42743
|
-
const {
|
|
42744
|
-
venues: venuesData
|
|
42745
|
-
} = getVenuesAndCourts$1({
|
|
42746
|
-
tournamentRecord
|
|
42747
|
-
});
|
|
42748
|
-
const eventsData = events.map(event => {
|
|
42749
|
-
const {
|
|
42750
|
-
eventId
|
|
42751
|
-
} = event;
|
|
42752
|
-
|
|
42753
|
-
const eventInfo = (({
|
|
42754
|
-
eventId,
|
|
42755
|
-
eventName,
|
|
42756
|
-
eventType,
|
|
42757
|
-
eventLevel,
|
|
42758
|
-
surfaceCategory,
|
|
42759
|
-
matchUpFormat,
|
|
42760
|
-
category,
|
|
42761
|
-
gender,
|
|
42762
|
-
startDate,
|
|
42763
|
-
endDate,
|
|
42764
|
-
ballType,
|
|
42765
|
-
discipline
|
|
42766
|
-
}) => ({
|
|
42767
|
-
eventId,
|
|
42768
|
-
eventName,
|
|
42769
|
-
eventType,
|
|
42770
|
-
eventLevel,
|
|
42771
|
-
surfaceCategory,
|
|
42772
|
-
matchUpFormat,
|
|
42773
|
-
category,
|
|
42774
|
-
gender,
|
|
42775
|
-
startDate,
|
|
42776
|
-
endDate,
|
|
42777
|
-
ballType,
|
|
42778
|
-
discipline
|
|
42779
|
-
}))(event);
|
|
42780
|
-
|
|
42781
|
-
const scheduleTiming = getScheduleTiming({
|
|
42782
|
-
tournamentRecord,
|
|
42783
|
-
event
|
|
42784
|
-
}).scheduleTiming;
|
|
42785
|
-
const drawsData = (event.drawDefinitions || []).map(drawDefinition => {
|
|
42786
|
-
const drawInfo = (({
|
|
42787
|
-
drawId,
|
|
42788
|
-
drawName,
|
|
42789
|
-
matchUpFormat,
|
|
42790
|
-
updatedAt
|
|
42791
|
-
}) => ({
|
|
42792
|
-
drawId,
|
|
42793
|
-
drawName,
|
|
42794
|
-
matchUpFormat,
|
|
42795
|
-
updatedAt
|
|
42796
|
-
}))(drawDefinition);
|
|
42797
|
-
|
|
42798
|
-
const {
|
|
42799
|
-
pendingMatchUps,
|
|
42800
|
-
completedMatchUps,
|
|
42801
|
-
upcomingMatchUps,
|
|
42802
|
-
abandonedMatchUps
|
|
42803
|
-
} = getDrawMatchUps({
|
|
42804
|
-
includeByeMatchUps: false,
|
|
42805
|
-
requireParticipants: true,
|
|
42806
|
-
tournamentParticipants,
|
|
42807
|
-
context: {
|
|
42808
|
-
eventId
|
|
42809
|
-
},
|
|
42810
|
-
policyDefinitions,
|
|
42811
|
-
tournamentRecord,
|
|
42812
|
-
inContext: true,
|
|
42813
|
-
drawDefinition,
|
|
42814
|
-
scheduleTiming,
|
|
42815
|
-
event
|
|
42816
|
-
});
|
|
42817
|
-
return {
|
|
42818
|
-
drawInfo,
|
|
42819
|
-
matchUps: {
|
|
42820
|
-
abandonedMatchUps,
|
|
42821
|
-
completedMatchUps,
|
|
42822
|
-
upcomingMatchUps,
|
|
42823
|
-
pendingMatchUps
|
|
42824
|
-
}
|
|
42825
|
-
};
|
|
42826
|
-
});
|
|
42827
|
-
const {
|
|
42828
|
-
timeItem
|
|
42829
|
-
} = getEventTimeItem({
|
|
42830
|
-
event,
|
|
42831
|
-
itemType: `${PUBLISH}.${STATUS$1}`
|
|
42832
|
-
});
|
|
42833
|
-
Object.assign(eventInfo, {
|
|
42834
|
-
publish: timeItem === null || timeItem === void 0 ? void 0 : timeItem.itemValue,
|
|
42835
|
-
drawsData
|
|
42836
|
-
});
|
|
42837
|
-
return eventInfo;
|
|
42838
|
-
});
|
|
42839
|
-
const allEventData = {
|
|
42840
|
-
tournamentInfo,
|
|
42841
|
-
venuesData,
|
|
42842
|
-
eventsData
|
|
42843
|
-
};
|
|
42844
|
-
return {
|
|
42845
|
-
allEventData
|
|
42846
|
-
};
|
|
42847
|
-
}
|
|
42848
|
-
|
|
42849
42998
|
const publishingGovernor = {
|
|
42850
42999
|
getTournamentInfo,
|
|
42851
43000
|
getVenueData,
|
|
@@ -42853,8 +43002,10 @@ const publishingGovernor = {
|
|
|
42853
43002
|
getAllEventData,
|
|
42854
43003
|
getEventData,
|
|
42855
43004
|
getDrawData,
|
|
42856
|
-
|
|
42857
|
-
|
|
43005
|
+
unPublishEventSeeding,
|
|
43006
|
+
publishEventSeeding,
|
|
43007
|
+
unPublishEvent,
|
|
43008
|
+
publishEvent
|
|
42858
43009
|
};
|
|
42859
43010
|
|
|
42860
43011
|
function analyzeDraws({
|
|
@@ -47556,8 +47707,8 @@ function bulkUpdatePublishedEventIds({
|
|
|
47556
47707
|
const {
|
|
47557
47708
|
timeItem
|
|
47558
47709
|
} = getEventTimeItem({
|
|
47559
|
-
|
|
47560
|
-
|
|
47710
|
+
itemType: `${PUBLISH}.${STATUS$1}`,
|
|
47711
|
+
event
|
|
47561
47712
|
});
|
|
47562
47713
|
const pubState = timeItem === null || timeItem === void 0 ? void 0 : timeItem.itemValue;
|
|
47563
47714
|
const {
|
|
@@ -47566,7 +47717,7 @@ function bulkUpdatePublishedEventIds({
|
|
|
47566
47717
|
const publishedDrawIds = eventIdsMap[eventId].filter(drawId => {
|
|
47567
47718
|
var _pubState$PUBLIC$draw;
|
|
47568
47719
|
|
|
47569
|
-
return pubState && pubState[PUBLIC] && ((_pubState$PUBLIC$draw = pubState[PUBLIC].drawIds) === null || _pubState$PUBLIC$draw === void 0 ? void 0 : _pubState$PUBLIC$draw.includes(drawId))
|
|
47720
|
+
return pubState && pubState[PUBLIC] && ((_pubState$PUBLIC$draw = pubState[PUBLIC].drawIds) === null || _pubState$PUBLIC$draw === void 0 ? void 0 : _pubState$PUBLIC$draw.includes(drawId));
|
|
47570
47721
|
});
|
|
47571
47722
|
return publishedDrawIds.length;
|
|
47572
47723
|
}).map(event => event.eventId);
|