tods-competition-factory 2.0.20 → 2.0.21
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 +11 -13
- package/dist/tods-competition-factory.development.cjs.js +427 -349
- 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 +1 -1
|
@@ -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.21';
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
const SUCCESS = { success: true };
|
|
@@ -11485,18 +11485,27 @@ function getPublishState(params) {
|
|
|
11485
11485
|
}
|
|
11486
11486
|
return { ...SUCCESS, publishState };
|
|
11487
11487
|
}
|
|
11488
|
+
const publishedEventIds = [];
|
|
11489
|
+
let tournamentPublished = false;
|
|
11488
11490
|
const publishState = {};
|
|
11489
11491
|
const pubStatus = getTournamentPublishStatus({ tournamentRecord });
|
|
11490
|
-
publishState.tournament = pubStatus;
|
|
11492
|
+
publishState.tournament = pubStatus ?? {};
|
|
11491
11493
|
for (const event of tournamentRecord?.events ?? []) {
|
|
11492
11494
|
const pubStatus = getPubStatus({ event });
|
|
11493
11495
|
publishState[event.eventId] = pubStatus;
|
|
11496
|
+
if (pubStatus.status.published) {
|
|
11497
|
+
publishedEventIds.push(event.eventId);
|
|
11498
|
+
tournamentPublished = true;
|
|
11499
|
+
}
|
|
11494
11500
|
for (const { drawId } of event.drawDefinitions ?? []) {
|
|
11495
11501
|
const published = pubStatus.status?.publishedDrawIds?.includes(drawId);
|
|
11496
11502
|
if (published)
|
|
11497
11503
|
publishState[drawId] = { status: { published } };
|
|
11498
11504
|
}
|
|
11499
11505
|
}
|
|
11506
|
+
if (tournamentRecord) {
|
|
11507
|
+
publishState.tournament.status = { published: tournamentPublished, publishedEventIds };
|
|
11508
|
+
}
|
|
11500
11509
|
return { ...SUCCESS, publishState };
|
|
11501
11510
|
}
|
|
11502
11511
|
function getPubStatus({ event }) {
|
|
@@ -16172,9 +16181,8 @@ function swapAssignedPositions({ candidatePositionAssignments, swapOptions }) {
|
|
|
16172
16181
|
}
|
|
16173
16182
|
|
|
16174
16183
|
function randomUnseededSeparation({ provisionalPositioning, unseededParticipantIds, inContextDrawMatchUps, unseededByePositions, tournamentRecord, drawDefinition, seedBlockInfo, participants, matchUpsMap, structureId, avoidance, drawSize, event, }) {
|
|
16175
|
-
if (!avoidance)
|
|
16184
|
+
if (!avoidance)
|
|
16176
16185
|
return { error: MISSING_AVOIDANCE_POLICY };
|
|
16177
|
-
}
|
|
16178
16186
|
const { candidatesCount = 1, policyAttributes, targetDivisions } = avoidance;
|
|
16179
16187
|
let { roundsToSeparate } = avoidance;
|
|
16180
16188
|
const stack = 'randomUnseededSeparation';
|
|
@@ -16222,9 +16230,8 @@ function randomUnseededSeparation({ provisionalPositioning, unseededParticipantI
|
|
|
16222
16230
|
idCollections,
|
|
16223
16231
|
participants,
|
|
16224
16232
|
});
|
|
16225
|
-
if (allGroups.error)
|
|
16233
|
+
if (allGroups.error)
|
|
16226
16234
|
return decorateResult({ result: allGroups, stack });
|
|
16227
|
-
}
|
|
16228
16235
|
const participantIdGroups = Object.assign({}, ...unseededParticipantIds.map((participantId) => {
|
|
16229
16236
|
const groups = Object.keys(allGroups).filter((key) => (allGroups[key] ?? []).includes(participantId));
|
|
16230
16237
|
return { [participantId]: groups };
|
|
@@ -17024,7 +17031,9 @@ function positionByes({ provisionalPositioning, tournamentRecord, appliedPolicie
|
|
|
17024
17031
|
return { ...SUCCESS, unseededByePositions, byeDrawPositions };
|
|
17025
17032
|
}
|
|
17026
17033
|
|
|
17027
|
-
function automatedPositioning(
|
|
17034
|
+
function automatedPositioning(params) {
|
|
17035
|
+
let { drawDefinition } = params;
|
|
17036
|
+
const { applyPositioning = true, provisionalPositioning, multipleStructures, placeByes = true, tournamentRecord, placementGroup, seedingProfile, structureId, seedLimit, seedsOnly, drawType, drawSize, event, } = params;
|
|
17028
17037
|
const positioningReport = [];
|
|
17029
17038
|
if (!applyPositioning) {
|
|
17030
17039
|
disableNotifications();
|
|
@@ -17046,13 +17055,12 @@ function automatedPositioning({ applyPositioning = true, provisionalPositioning,
|
|
|
17046
17055
|
const structure = result.structure;
|
|
17047
17056
|
if (!structure)
|
|
17048
17057
|
return { error: STRUCTURE_NOT_FOUND };
|
|
17049
|
-
|
|
17050
|
-
|
|
17058
|
+
const appliedPolicies = params.appliedPolicies ||
|
|
17059
|
+
getAppliedPolicies({
|
|
17051
17060
|
drawDefinition,
|
|
17052
17061
|
structure,
|
|
17053
17062
|
event,
|
|
17054
17063
|
})?.appliedPolicies;
|
|
17055
|
-
}
|
|
17056
17064
|
const { qualifiersCount } = getQualifiersCount({
|
|
17057
17065
|
stageSequence: structure.stageSequence,
|
|
17058
17066
|
provisionalPositioning,
|
|
@@ -17072,14 +17080,13 @@ function automatedPositioning({ applyPositioning = true, provisionalPositioning,
|
|
|
17072
17080
|
});
|
|
17073
17081
|
if (!entries?.length && !qualifiersCount)
|
|
17074
17082
|
return handleSuccessCondition({ ...SUCCESS });
|
|
17075
|
-
matchUpsMap = matchUpsMap ?? getMatchUpsMap({ drawDefinition });
|
|
17076
|
-
|
|
17077
|
-
|
|
17083
|
+
const matchUpsMap = params.matchUpsMap ?? getMatchUpsMap({ drawDefinition });
|
|
17084
|
+
const inContextDrawMatchUps = params.inContextDrawMatchUps ??
|
|
17085
|
+
getAllDrawMatchUps({
|
|
17078
17086
|
inContext: true,
|
|
17079
17087
|
drawDefinition,
|
|
17080
17088
|
matchUpsMap,
|
|
17081
|
-
})
|
|
17082
|
-
}
|
|
17089
|
+
})?.matchUps;
|
|
17083
17090
|
let unseededByePositions = [];
|
|
17084
17091
|
const seedBlockInfo = getValidSeedBlocks({
|
|
17085
17092
|
provisionalPositioning,
|
|
@@ -17092,12 +17099,14 @@ function automatedPositioning({ applyPositioning = true, provisionalPositioning,
|
|
|
17092
17099
|
return seedBlockInfo;
|
|
17093
17100
|
const { validSeedBlocks } = seedBlockInfo;
|
|
17094
17101
|
positioningReport.push({ validSeedBlocks });
|
|
17095
|
-
const participants =
|
|
17096
|
-
|
|
17097
|
-
|
|
17098
|
-
|
|
17099
|
-
|
|
17100
|
-
|
|
17102
|
+
const participants = params.participants ||
|
|
17103
|
+
(tournamentRecord
|
|
17104
|
+
? getParticipants({
|
|
17105
|
+
withIndividualParticipants: true,
|
|
17106
|
+
convertExtensions: true,
|
|
17107
|
+
tournamentRecord,
|
|
17108
|
+
})?.participants
|
|
17109
|
+
: []);
|
|
17101
17110
|
if (getSeedPattern(structure.seedingProfile || seedingProfile) === WATERFALL) {
|
|
17102
17111
|
let result = placeByes
|
|
17103
17112
|
? positionByes({
|
|
@@ -26684,10 +26693,75 @@ function getCompetitionPenalties({ tournamentRecords }) {
|
|
|
26684
26693
|
return { penalties: allPenalties };
|
|
26685
26694
|
}
|
|
26686
26695
|
|
|
26687
|
-
function
|
|
26696
|
+
function extractEventInfo({ event }) {
|
|
26697
|
+
const eventInfo = (({ eventId, eventName, eventType, eventLevel, surfaceCategory, matchUpFormat, category, gender, startDate, endDate, ballType, discipline, onlineResources, notes, }) => ({
|
|
26698
|
+
eventId,
|
|
26699
|
+
eventName,
|
|
26700
|
+
eventType,
|
|
26701
|
+
eventLevel,
|
|
26702
|
+
surfaceCategory,
|
|
26703
|
+
matchUpFormat,
|
|
26704
|
+
category,
|
|
26705
|
+
gender,
|
|
26706
|
+
startDate,
|
|
26707
|
+
endDate,
|
|
26708
|
+
ballType,
|
|
26709
|
+
discipline,
|
|
26710
|
+
onlineResources,
|
|
26711
|
+
notes,
|
|
26712
|
+
}))(event);
|
|
26713
|
+
return { eventInfo };
|
|
26714
|
+
}
|
|
26715
|
+
|
|
26716
|
+
const POLICY_PRIVACY_STAFF = {
|
|
26717
|
+
[POLICY_TYPE_PARTICIPANT]: {
|
|
26718
|
+
policyName: 'Staff Privacy Policy',
|
|
26719
|
+
participant: {
|
|
26720
|
+
contacts: false,
|
|
26721
|
+
individualParticipants: false,
|
|
26722
|
+
individualParticipantIds: false,
|
|
26723
|
+
onlineResources: false,
|
|
26724
|
+
participantName: true,
|
|
26725
|
+
participantOtherName: true,
|
|
26726
|
+
participantId: true,
|
|
26727
|
+
participantRole: true,
|
|
26728
|
+
participantRoleResponsibilities: true,
|
|
26729
|
+
participantStatus: true,
|
|
26730
|
+
penalties: false,
|
|
26731
|
+
representing: true,
|
|
26732
|
+
participantType: true,
|
|
26733
|
+
person: {
|
|
26734
|
+
addresses: false,
|
|
26735
|
+
biographicalInformation: false,
|
|
26736
|
+
birthDate: false,
|
|
26737
|
+
contacts: false,
|
|
26738
|
+
nationalityCode: true,
|
|
26739
|
+
nativeFamilyName: false,
|
|
26740
|
+
nativeGivenName: false,
|
|
26741
|
+
onlineResources: false,
|
|
26742
|
+
otherNames: true,
|
|
26743
|
+
parentOrganisationId: false,
|
|
26744
|
+
passportFamilyName: false,
|
|
26745
|
+
passportGivenName: false,
|
|
26746
|
+
personId: false,
|
|
26747
|
+
personOtherIds: false,
|
|
26748
|
+
previousNames: false,
|
|
26749
|
+
sex: false,
|
|
26750
|
+
standardFamilyName: true,
|
|
26751
|
+
standardGivenName: true,
|
|
26752
|
+
status: false,
|
|
26753
|
+
tennisId: false,
|
|
26754
|
+
wheelchair: true,
|
|
26755
|
+
},
|
|
26756
|
+
},
|
|
26757
|
+
},
|
|
26758
|
+
};
|
|
26759
|
+
|
|
26760
|
+
function getTournamentInfo(params) {
|
|
26761
|
+
const { tournamentRecord } = params ?? {};
|
|
26688
26762
|
if (!tournamentRecord)
|
|
26689
26763
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
26690
|
-
const tournamentInfo = (({ tournamentId, tournamentRank, tournamentStatus, formalName, tournamentName, promotionalName, onlineResources, localTimeZone, startDate, endDate, hostCountryCode,
|
|
26764
|
+
const tournamentInfo = (({ tournamentId, tournamentRank, tournamentStatus, formalName, tournamentName, promotionalName, onlineResources, localTimeZone, startDate, endDate, hostCountryCode, venues, notes, updatedAt, }) => ({
|
|
26691
26765
|
tournamentId,
|
|
26692
26766
|
tournamentRank,
|
|
26693
26767
|
tournamentStatus,
|
|
@@ -26699,12 +26773,31 @@ function getTournamentInfo({ tournamentRecord }) {
|
|
|
26699
26773
|
startDate,
|
|
26700
26774
|
endDate,
|
|
26701
26775
|
hostCountryCode,
|
|
26702
|
-
|
|
26703
|
-
|
|
26776
|
+
venues,
|
|
26777
|
+
notes,
|
|
26778
|
+
updatedAt,
|
|
26704
26779
|
}))(tournamentRecord);
|
|
26780
|
+
const tournamentContacts = getParticipants({
|
|
26781
|
+
participantFilters: { participantRoles: [ADMINISTRATION, OFFICIAL, MEDIA, MEDICAL, SECURITY] },
|
|
26782
|
+
policyDefinitions: POLICY_PRIVACY_STAFF,
|
|
26783
|
+
tournamentRecord,
|
|
26784
|
+
}).participants;
|
|
26785
|
+
if (tournamentContacts)
|
|
26786
|
+
tournamentInfo.tournamentContacts = tournamentContacts;
|
|
26787
|
+
const publishState = getPublishState({ tournamentRecord })?.publishState;
|
|
26788
|
+
const publishedEventIds = publishState?.tournament?.status?.publishedEventIds || [];
|
|
26789
|
+
const eventInfo = [];
|
|
26790
|
+
for (const event of tournamentRecord.events || []) {
|
|
26791
|
+
if (publishedEventIds.includes(event.eventId)) {
|
|
26792
|
+
const info = extractEventInfo({ event }).eventInfo;
|
|
26793
|
+
if (info)
|
|
26794
|
+
eventInfo.push(info);
|
|
26795
|
+
}
|
|
26796
|
+
}
|
|
26797
|
+
tournamentInfo.eventInfo = eventInfo;
|
|
26705
26798
|
return {
|
|
26706
|
-
...SUCCESS,
|
|
26707
26799
|
tournamentInfo: makeDeepCopy(tournamentInfo, false, true),
|
|
26800
|
+
...SUCCESS,
|
|
26708
26801
|
};
|
|
26709
26802
|
}
|
|
26710
26803
|
|
|
@@ -46890,313 +46983,6 @@ function addTournamentParticipants({ participantsProfile, tournamentRecord, even
|
|
|
46890
46983
|
return { addedCount, ...SUCCESS };
|
|
46891
46984
|
}
|
|
46892
46985
|
|
|
46893
|
-
const courtTemplate = () => ({
|
|
46894
|
-
altitude: undefined,
|
|
46895
|
-
courtId: undefined,
|
|
46896
|
-
courtName: '',
|
|
46897
|
-
courtDimensions: undefined,
|
|
46898
|
-
latitude: undefined,
|
|
46899
|
-
longitude: undefined,
|
|
46900
|
-
surfaceCategory: undefined,
|
|
46901
|
-
surfaceType: undefined,
|
|
46902
|
-
surfacedDate: undefined,
|
|
46903
|
-
dateAvailability: [],
|
|
46904
|
-
onlineResources: [],
|
|
46905
|
-
pace: undefined,
|
|
46906
|
-
notes: undefined,
|
|
46907
|
-
});
|
|
46908
|
-
|
|
46909
|
-
function getInt(value) {
|
|
46910
|
-
return parseInt(value);
|
|
46911
|
-
}
|
|
46912
|
-
function validTimePeriod({ startTime = '', endTime = '' } = {}) {
|
|
46913
|
-
if (!startTime || !endTime || !timeValidation.test(startTime) || !timeValidation.test(endTime))
|
|
46914
|
-
return false;
|
|
46915
|
-
const [startHour, startMinute] = startTime.split(':').map(getInt);
|
|
46916
|
-
const [endHour, endMinute] = endTime.split(':').map(getInt);
|
|
46917
|
-
if (endHour < startHour)
|
|
46918
|
-
return false;
|
|
46919
|
-
return startHour === endHour && endMinute < startMinute ? false : true;
|
|
46920
|
-
}
|
|
46921
|
-
function startTimeSort(a, b) {
|
|
46922
|
-
const [startHourA, startMinuteA] = a.startTime.split(':').map(getInt);
|
|
46923
|
-
const [startHourB, startMinuteB] = b.startTime.split(':').map(getInt);
|
|
46924
|
-
if (startHourA < startHourB)
|
|
46925
|
-
return -1;
|
|
46926
|
-
if (startHourA > startHourB)
|
|
46927
|
-
return 1;
|
|
46928
|
-
if (startMinuteA < startMinuteB)
|
|
46929
|
-
return -1;
|
|
46930
|
-
if (startMinuteA > startMinuteB)
|
|
46931
|
-
return 1;
|
|
46932
|
-
return 0;
|
|
46933
|
-
}
|
|
46934
|
-
|
|
46935
|
-
function validDateAvailability({ dateAvailability }) {
|
|
46936
|
-
if (!dateAvailability)
|
|
46937
|
-
return { error: MISSING_DATE_AVAILABILITY };
|
|
46938
|
-
if (!Array.isArray(dateAvailability))
|
|
46939
|
-
return { error: INVALID_DATE_AVAILABILITY };
|
|
46940
|
-
const dateNote = 'Dates must be formated => YYYY-MM-DD';
|
|
46941
|
-
const timeNote = 'Times must be 24 hour => 00:00';
|
|
46942
|
-
for (const availability of dateAvailability) {
|
|
46943
|
-
if (typeof availability !== 'object') {
|
|
46944
|
-
return { error: INVALID_DATE_AVAILABILITY };
|
|
46945
|
-
}
|
|
46946
|
-
const { date, startTime, endTime, bookings = [] } = availability;
|
|
46947
|
-
if (!startTime || !endTime) {
|
|
46948
|
-
return { error: INVALID_DATE_AVAILABILITY };
|
|
46949
|
-
}
|
|
46950
|
-
if (date && !dateValidation.test(date)) {
|
|
46951
|
-
return {
|
|
46952
|
-
error: INVALID_DATE,
|
|
46953
|
-
dateAvailability: { date },
|
|
46954
|
-
info: dateNote,
|
|
46955
|
-
};
|
|
46956
|
-
}
|
|
46957
|
-
if (!timeValidation.test(startTime)) {
|
|
46958
|
-
return {
|
|
46959
|
-
error: INVALID_TIME,
|
|
46960
|
-
dateAvailability: { startTime },
|
|
46961
|
-
info: timeNote,
|
|
46962
|
-
};
|
|
46963
|
-
}
|
|
46964
|
-
if (!timeValidation.test(endTime)) {
|
|
46965
|
-
return {
|
|
46966
|
-
error: INVALID_TIME,
|
|
46967
|
-
dateAvailability: { endTime },
|
|
46968
|
-
info: timeNote,
|
|
46969
|
-
};
|
|
46970
|
-
}
|
|
46971
|
-
if (startTime === endTime) {
|
|
46972
|
-
return {
|
|
46973
|
-
error: INVALID_TIME,
|
|
46974
|
-
dateAvailability: { startTime, endTime },
|
|
46975
|
-
info: 'startTime and endTime are equivalent',
|
|
46976
|
-
};
|
|
46977
|
-
}
|
|
46978
|
-
if (!validTimePeriod({ startTime, endTime })) {
|
|
46979
|
-
return {
|
|
46980
|
-
error: INVALID_TIME,
|
|
46981
|
-
dateAvailability: { startTime, endTime },
|
|
46982
|
-
info: 'endTime must be after startTime',
|
|
46983
|
-
};
|
|
46984
|
-
}
|
|
46985
|
-
if (bookings) {
|
|
46986
|
-
if (!Array.isArray(bookings)) {
|
|
46987
|
-
return { error: INVALID_BOOKINGS };
|
|
46988
|
-
}
|
|
46989
|
-
for (const booking of bookings) {
|
|
46990
|
-
if (typeof booking !== 'object') {
|
|
46991
|
-
return { error: INVALID_BOOKINGS };
|
|
46992
|
-
}
|
|
46993
|
-
const { startTime, endTime } = booking;
|
|
46994
|
-
if (!timeValidation.test(startTime)) {
|
|
46995
|
-
return {
|
|
46996
|
-
error: INVALID_TIME,
|
|
46997
|
-
booking: { startTime },
|
|
46998
|
-
info: timeNote,
|
|
46999
|
-
};
|
|
47000
|
-
}
|
|
47001
|
-
if (!timeValidation.test(endTime)) {
|
|
47002
|
-
return {
|
|
47003
|
-
error: INVALID_TIME,
|
|
47004
|
-
booking: { endTime },
|
|
47005
|
-
info: timeNote,
|
|
47006
|
-
};
|
|
47007
|
-
}
|
|
47008
|
-
if (startTime === endTime) {
|
|
47009
|
-
return {
|
|
47010
|
-
error: INVALID_TIME,
|
|
47011
|
-
dateAvailability: { startTime, endTime },
|
|
47012
|
-
info: 'startTime and endTime are equivalent',
|
|
47013
|
-
};
|
|
47014
|
-
}
|
|
47015
|
-
if (!validTimePeriod({ startTime, endTime })) {
|
|
47016
|
-
return {
|
|
47017
|
-
error: INVALID_TIME,
|
|
47018
|
-
dateAvailability: { startTime, endTime },
|
|
47019
|
-
info: 'endTime must be after startTime',
|
|
47020
|
-
};
|
|
47021
|
-
}
|
|
47022
|
-
}
|
|
47023
|
-
}
|
|
47024
|
-
}
|
|
47025
|
-
return { valid: true };
|
|
47026
|
-
}
|
|
47027
|
-
|
|
47028
|
-
function addCourt({ tournamentRecord, disableNotice, venueId, courtId, court }) {
|
|
47029
|
-
const { venue } = findVenue({ tournamentRecord, venueId });
|
|
47030
|
-
if (!venue)
|
|
47031
|
-
return { error: VENUE_NOT_FOUND };
|
|
47032
|
-
if (!venue.courts)
|
|
47033
|
-
venue.courts = [];
|
|
47034
|
-
const courtRecord = { ...courtTemplate(), venueId, courtId };
|
|
47035
|
-
if (!courtRecord.courtId) {
|
|
47036
|
-
courtRecord.courtId = UUID();
|
|
47037
|
-
}
|
|
47038
|
-
const courtExists = venue.courts.some((candidate) => candidate.courtId === courtRecord.courtId);
|
|
47039
|
-
if (courtExists) {
|
|
47040
|
-
return { error: COURT_EXISTS };
|
|
47041
|
-
}
|
|
47042
|
-
else {
|
|
47043
|
-
const dateAvailability = (court?.dateAvailability || []).map((availabilty) => ({
|
|
47044
|
-
...availabilty,
|
|
47045
|
-
date: extractDate(availabilty.date),
|
|
47046
|
-
startTime: extractTime(availabilty.startTime),
|
|
47047
|
-
endTime: extractTime(availabilty.endTime),
|
|
47048
|
-
bookings: availabilty.bookings?.map(({ startTime, endTime, bookingType }) => ({
|
|
47049
|
-
startTime: extractTime(startTime),
|
|
47050
|
-
endTime: extractTime(endTime),
|
|
47051
|
-
bookingType,
|
|
47052
|
-
})),
|
|
47053
|
-
}));
|
|
47054
|
-
const attributes = Object.keys(courtRecord);
|
|
47055
|
-
for (const attribute of attributes) {
|
|
47056
|
-
if (court?.[attribute]) {
|
|
47057
|
-
if (attribute === 'dateAvailability') {
|
|
47058
|
-
const result = validDateAvailability({ dateAvailability });
|
|
47059
|
-
if (!result.valid && result.error)
|
|
47060
|
-
return result;
|
|
47061
|
-
courtRecord.dateAvailability = dateAvailability;
|
|
47062
|
-
}
|
|
47063
|
-
else {
|
|
47064
|
-
courtRecord[attribute] = court[attribute];
|
|
47065
|
-
}
|
|
47066
|
-
}
|
|
47067
|
-
}
|
|
47068
|
-
const newCourt = courtRecord;
|
|
47069
|
-
venue.courts.push(newCourt);
|
|
47070
|
-
if (!disableNotice) {
|
|
47071
|
-
addNotice({
|
|
47072
|
-
payload: { venue, tournamentId: tournamentRecord.tournamentId },
|
|
47073
|
-
topic: MODIFY_VENUE,
|
|
47074
|
-
key: venue.venueId,
|
|
47075
|
-
});
|
|
47076
|
-
}
|
|
47077
|
-
return { ...SUCCESS, court: makeDeepCopy(courtRecord), venueId };
|
|
47078
|
-
}
|
|
47079
|
-
}
|
|
47080
|
-
function addCourts(params) {
|
|
47081
|
-
const { tournamentRecord, venueId } = params;
|
|
47082
|
-
if (typeof venueId !== 'string' || !venueId)
|
|
47083
|
-
return { error: MISSING_VENUE_ID };
|
|
47084
|
-
const tournamentRecords = params.tournamentRecords ??
|
|
47085
|
-
(tournamentRecord && {
|
|
47086
|
-
[tournamentRecord.tournamentId]: tournamentRecord,
|
|
47087
|
-
}) ??
|
|
47088
|
-
{};
|
|
47089
|
-
const courtIds = [];
|
|
47090
|
-
let success;
|
|
47091
|
-
for (const tournamentRecord of Object.values(tournamentRecords)) {
|
|
47092
|
-
const { venue } = findVenue({ tournamentRecord, venueId });
|
|
47093
|
-
if (venue) {
|
|
47094
|
-
const result = courtsAdd({ ...params, tournamentRecord });
|
|
47095
|
-
for (const court of result?.courts ?? []) {
|
|
47096
|
-
courtIds.push(court?.courtId);
|
|
47097
|
-
}
|
|
47098
|
-
if (result.error)
|
|
47099
|
-
return result;
|
|
47100
|
-
success = true;
|
|
47101
|
-
}
|
|
47102
|
-
}
|
|
47103
|
-
return success ? { ...SUCCESS, courtIds } : { error: VENUE_NOT_FOUND };
|
|
47104
|
-
}
|
|
47105
|
-
function courtsAdd({ courtNameRoot = 'Court', dateAvailability = [], venueAbbreviationRoot, tournamentRecord, courtNames = [], courtTimings, courtsCount, startTime, courtIds, endTime, idPrefix, venueId, dates, }) {
|
|
47106
|
-
if (!venueId)
|
|
47107
|
-
return { error: MISSING_VENUE_ID };
|
|
47108
|
-
const result = findVenue({ tournamentRecord, venueId });
|
|
47109
|
-
if (result.error)
|
|
47110
|
-
return result;
|
|
47111
|
-
const { venue } = result;
|
|
47112
|
-
if (!isNumeric(courtsCount) || !courtNames)
|
|
47113
|
-
return { error: MISSING_COURTS_INFO };
|
|
47114
|
-
courtsCount = courtsCount ?? courtNames.length;
|
|
47115
|
-
const courts = generateRange(0, courtsCount).map((i) => {
|
|
47116
|
-
const courtTiming = courtTimings?.[i];
|
|
47117
|
-
const courtAvailability = courtTiming
|
|
47118
|
-
? dates.map((date) => ({
|
|
47119
|
-
date: formatDate(date),
|
|
47120
|
-
startTime,
|
|
47121
|
-
endTime,
|
|
47122
|
-
...courtTiming,
|
|
47123
|
-
}))
|
|
47124
|
-
: dateAvailability;
|
|
47125
|
-
if (courtTiming && startTime && endTime)
|
|
47126
|
-
courtAvailability.push({ startTime, endTime });
|
|
47127
|
-
return {
|
|
47128
|
-
courtName: courtNames[i] ||
|
|
47129
|
-
(venueAbbreviationRoot && venue?.venueAbbreviation && `${venue?.venueAbbreviation} ${i + 1}`) ||
|
|
47130
|
-
`${courtNameRoot} ${i + 1}`,
|
|
47131
|
-
dateAvailability: courtAvailability,
|
|
47132
|
-
};
|
|
47133
|
-
});
|
|
47134
|
-
const mapResult = courts.map((court, i) => {
|
|
47135
|
-
const courtId = courtIds?.pop() || (idPrefix && `${idPrefix}-${i + 1}`);
|
|
47136
|
-
return addCourt({
|
|
47137
|
-
disableNotice: true,
|
|
47138
|
-
tournamentRecord,
|
|
47139
|
-
courtId,
|
|
47140
|
-
venueId,
|
|
47141
|
-
court,
|
|
47142
|
-
});
|
|
47143
|
-
});
|
|
47144
|
-
const courtRecords = mapResult.map((outcome) => outcome.court).filter(Boolean);
|
|
47145
|
-
if (courtRecords.length !== courtsCount) {
|
|
47146
|
-
return decorateResult({
|
|
47147
|
-
info: 'not all courts could be generated',
|
|
47148
|
-
result: { error: INVALID_VALUES },
|
|
47149
|
-
});
|
|
47150
|
-
}
|
|
47151
|
-
if (venue)
|
|
47152
|
-
addNotice({
|
|
47153
|
-
payload: { venue, tournamentId: tournamentRecord.tournamentId },
|
|
47154
|
-
topic: MODIFY_VENUE,
|
|
47155
|
-
key: venue.venueId,
|
|
47156
|
-
});
|
|
47157
|
-
return { ...SUCCESS, courts: makeDeepCopy(courtRecords) };
|
|
47158
|
-
}
|
|
47159
|
-
|
|
47160
|
-
function generateVenues({ tournamentRecord, venueProfiles, uuids }) {
|
|
47161
|
-
const { startDate, endDate } = tournamentRecord;
|
|
47162
|
-
const venueIds = [];
|
|
47163
|
-
for (const [index, venueProfile] of venueProfiles.entries()) {
|
|
47164
|
-
const { venueAbbreviation, venueId = uuids?.pop() ?? UUID(), dateAvailability, startTime = '07:00', endTime = '19:00', courtTimings, courtsCount, courtNames, venueName, idPrefix, courtIds, } = venueProfile;
|
|
47165
|
-
const newVenue = {
|
|
47166
|
-
venueName: venueName || `Venue ${index + 1}`,
|
|
47167
|
-
venueAbbreviation,
|
|
47168
|
-
venueId,
|
|
47169
|
-
};
|
|
47170
|
-
const result = addVenue({ tournamentRecord, venue: newVenue });
|
|
47171
|
-
if (result.error)
|
|
47172
|
-
return result;
|
|
47173
|
-
venueIds.push(venueId);
|
|
47174
|
-
const dates = generateDateRange(startDate, endDate);
|
|
47175
|
-
const generatedDateAvailability = !Array.isArray(dateAvailability) &&
|
|
47176
|
-
[{ startTime, endTime }].concat(dates.map((date) => ({
|
|
47177
|
-
date: formatDate(date),
|
|
47178
|
-
startTime,
|
|
47179
|
-
endTime,
|
|
47180
|
-
})));
|
|
47181
|
-
const addResult = addCourts({
|
|
47182
|
-
dateAvailability: dateAvailability || generatedDateAvailability,
|
|
47183
|
-
tournamentRecord,
|
|
47184
|
-
courtTimings,
|
|
47185
|
-
courtsCount,
|
|
47186
|
-
courtNames,
|
|
47187
|
-
startTime,
|
|
47188
|
-
idPrefix,
|
|
47189
|
-
courtIds,
|
|
47190
|
-
endTime,
|
|
47191
|
-
venueId,
|
|
47192
|
-
dates,
|
|
47193
|
-
});
|
|
47194
|
-
if (addResult.error)
|
|
47195
|
-
return addResult;
|
|
47196
|
-
}
|
|
47197
|
-
return venueIds;
|
|
47198
|
-
}
|
|
47199
|
-
|
|
47200
46986
|
function getStageParticipantsCount({ drawProfiles, category, gender }) {
|
|
47201
46987
|
const uniqueParticipantsCount = {};
|
|
47202
46988
|
const stageParticipantsCount = drawProfiles?.reduce((stageParticipantsCount, drawProfile) => {
|
|
@@ -48687,6 +48473,313 @@ function generateEventWithDraw(params) {
|
|
|
48687
48473
|
};
|
|
48688
48474
|
}
|
|
48689
48475
|
|
|
48476
|
+
const courtTemplate = () => ({
|
|
48477
|
+
altitude: undefined,
|
|
48478
|
+
courtId: undefined,
|
|
48479
|
+
courtName: '',
|
|
48480
|
+
courtDimensions: undefined,
|
|
48481
|
+
latitude: undefined,
|
|
48482
|
+
longitude: undefined,
|
|
48483
|
+
surfaceCategory: undefined,
|
|
48484
|
+
surfaceType: undefined,
|
|
48485
|
+
surfacedDate: undefined,
|
|
48486
|
+
dateAvailability: [],
|
|
48487
|
+
onlineResources: [],
|
|
48488
|
+
pace: undefined,
|
|
48489
|
+
notes: undefined,
|
|
48490
|
+
});
|
|
48491
|
+
|
|
48492
|
+
function getInt(value) {
|
|
48493
|
+
return parseInt(value);
|
|
48494
|
+
}
|
|
48495
|
+
function validTimePeriod({ startTime = '', endTime = '' } = {}) {
|
|
48496
|
+
if (!startTime || !endTime || !timeValidation.test(startTime) || !timeValidation.test(endTime))
|
|
48497
|
+
return false;
|
|
48498
|
+
const [startHour, startMinute] = startTime.split(':').map(getInt);
|
|
48499
|
+
const [endHour, endMinute] = endTime.split(':').map(getInt);
|
|
48500
|
+
if (endHour < startHour)
|
|
48501
|
+
return false;
|
|
48502
|
+
return startHour === endHour && endMinute < startMinute ? false : true;
|
|
48503
|
+
}
|
|
48504
|
+
function startTimeSort(a, b) {
|
|
48505
|
+
const [startHourA, startMinuteA] = a.startTime.split(':').map(getInt);
|
|
48506
|
+
const [startHourB, startMinuteB] = b.startTime.split(':').map(getInt);
|
|
48507
|
+
if (startHourA < startHourB)
|
|
48508
|
+
return -1;
|
|
48509
|
+
if (startHourA > startHourB)
|
|
48510
|
+
return 1;
|
|
48511
|
+
if (startMinuteA < startMinuteB)
|
|
48512
|
+
return -1;
|
|
48513
|
+
if (startMinuteA > startMinuteB)
|
|
48514
|
+
return 1;
|
|
48515
|
+
return 0;
|
|
48516
|
+
}
|
|
48517
|
+
|
|
48518
|
+
function validDateAvailability({ dateAvailability }) {
|
|
48519
|
+
if (!dateAvailability)
|
|
48520
|
+
return { error: MISSING_DATE_AVAILABILITY };
|
|
48521
|
+
if (!Array.isArray(dateAvailability))
|
|
48522
|
+
return { error: INVALID_DATE_AVAILABILITY };
|
|
48523
|
+
const dateNote = 'Dates must be formated => YYYY-MM-DD';
|
|
48524
|
+
const timeNote = 'Times must be 24 hour => 00:00';
|
|
48525
|
+
for (const availability of dateAvailability) {
|
|
48526
|
+
if (typeof availability !== 'object') {
|
|
48527
|
+
return { error: INVALID_DATE_AVAILABILITY };
|
|
48528
|
+
}
|
|
48529
|
+
const { date, startTime, endTime, bookings = [] } = availability;
|
|
48530
|
+
if (!startTime || !endTime) {
|
|
48531
|
+
return { error: INVALID_DATE_AVAILABILITY };
|
|
48532
|
+
}
|
|
48533
|
+
if (date && !dateValidation.test(date)) {
|
|
48534
|
+
return {
|
|
48535
|
+
error: INVALID_DATE,
|
|
48536
|
+
dateAvailability: { date },
|
|
48537
|
+
info: dateNote,
|
|
48538
|
+
};
|
|
48539
|
+
}
|
|
48540
|
+
if (!timeValidation.test(startTime)) {
|
|
48541
|
+
return {
|
|
48542
|
+
error: INVALID_TIME,
|
|
48543
|
+
dateAvailability: { startTime },
|
|
48544
|
+
info: timeNote,
|
|
48545
|
+
};
|
|
48546
|
+
}
|
|
48547
|
+
if (!timeValidation.test(endTime)) {
|
|
48548
|
+
return {
|
|
48549
|
+
error: INVALID_TIME,
|
|
48550
|
+
dateAvailability: { endTime },
|
|
48551
|
+
info: timeNote,
|
|
48552
|
+
};
|
|
48553
|
+
}
|
|
48554
|
+
if (startTime === endTime) {
|
|
48555
|
+
return {
|
|
48556
|
+
error: INVALID_TIME,
|
|
48557
|
+
dateAvailability: { startTime, endTime },
|
|
48558
|
+
info: 'startTime and endTime are equivalent',
|
|
48559
|
+
};
|
|
48560
|
+
}
|
|
48561
|
+
if (!validTimePeriod({ startTime, endTime })) {
|
|
48562
|
+
return {
|
|
48563
|
+
error: INVALID_TIME,
|
|
48564
|
+
dateAvailability: { startTime, endTime },
|
|
48565
|
+
info: 'endTime must be after startTime',
|
|
48566
|
+
};
|
|
48567
|
+
}
|
|
48568
|
+
if (bookings) {
|
|
48569
|
+
if (!Array.isArray(bookings)) {
|
|
48570
|
+
return { error: INVALID_BOOKINGS };
|
|
48571
|
+
}
|
|
48572
|
+
for (const booking of bookings) {
|
|
48573
|
+
if (typeof booking !== 'object') {
|
|
48574
|
+
return { error: INVALID_BOOKINGS };
|
|
48575
|
+
}
|
|
48576
|
+
const { startTime, endTime } = booking;
|
|
48577
|
+
if (!timeValidation.test(startTime)) {
|
|
48578
|
+
return {
|
|
48579
|
+
error: INVALID_TIME,
|
|
48580
|
+
booking: { startTime },
|
|
48581
|
+
info: timeNote,
|
|
48582
|
+
};
|
|
48583
|
+
}
|
|
48584
|
+
if (!timeValidation.test(endTime)) {
|
|
48585
|
+
return {
|
|
48586
|
+
error: INVALID_TIME,
|
|
48587
|
+
booking: { endTime },
|
|
48588
|
+
info: timeNote,
|
|
48589
|
+
};
|
|
48590
|
+
}
|
|
48591
|
+
if (startTime === endTime) {
|
|
48592
|
+
return {
|
|
48593
|
+
error: INVALID_TIME,
|
|
48594
|
+
dateAvailability: { startTime, endTime },
|
|
48595
|
+
info: 'startTime and endTime are equivalent',
|
|
48596
|
+
};
|
|
48597
|
+
}
|
|
48598
|
+
if (!validTimePeriod({ startTime, endTime })) {
|
|
48599
|
+
return {
|
|
48600
|
+
error: INVALID_TIME,
|
|
48601
|
+
dateAvailability: { startTime, endTime },
|
|
48602
|
+
info: 'endTime must be after startTime',
|
|
48603
|
+
};
|
|
48604
|
+
}
|
|
48605
|
+
}
|
|
48606
|
+
}
|
|
48607
|
+
}
|
|
48608
|
+
return { valid: true };
|
|
48609
|
+
}
|
|
48610
|
+
|
|
48611
|
+
function addCourt({ tournamentRecord, disableNotice, venueId, courtId, court }) {
|
|
48612
|
+
const { venue } = findVenue({ tournamentRecord, venueId });
|
|
48613
|
+
if (!venue)
|
|
48614
|
+
return { error: VENUE_NOT_FOUND };
|
|
48615
|
+
if (!venue.courts)
|
|
48616
|
+
venue.courts = [];
|
|
48617
|
+
const courtRecord = { ...courtTemplate(), venueId, courtId };
|
|
48618
|
+
if (!courtRecord.courtId) {
|
|
48619
|
+
courtRecord.courtId = UUID();
|
|
48620
|
+
}
|
|
48621
|
+
const courtExists = venue.courts.some((candidate) => candidate.courtId === courtRecord.courtId);
|
|
48622
|
+
if (courtExists) {
|
|
48623
|
+
return { error: COURT_EXISTS };
|
|
48624
|
+
}
|
|
48625
|
+
else {
|
|
48626
|
+
const dateAvailability = (court?.dateAvailability || []).map((availabilty) => ({
|
|
48627
|
+
...availabilty,
|
|
48628
|
+
date: extractDate(availabilty.date),
|
|
48629
|
+
startTime: extractTime(availabilty.startTime),
|
|
48630
|
+
endTime: extractTime(availabilty.endTime),
|
|
48631
|
+
bookings: availabilty.bookings?.map(({ startTime, endTime, bookingType }) => ({
|
|
48632
|
+
startTime: extractTime(startTime),
|
|
48633
|
+
endTime: extractTime(endTime),
|
|
48634
|
+
bookingType,
|
|
48635
|
+
})),
|
|
48636
|
+
}));
|
|
48637
|
+
const attributes = Object.keys(courtRecord);
|
|
48638
|
+
for (const attribute of attributes) {
|
|
48639
|
+
if (court?.[attribute]) {
|
|
48640
|
+
if (attribute === 'dateAvailability') {
|
|
48641
|
+
const result = validDateAvailability({ dateAvailability });
|
|
48642
|
+
if (!result.valid && result.error)
|
|
48643
|
+
return result;
|
|
48644
|
+
courtRecord.dateAvailability = dateAvailability;
|
|
48645
|
+
}
|
|
48646
|
+
else {
|
|
48647
|
+
courtRecord[attribute] = court[attribute];
|
|
48648
|
+
}
|
|
48649
|
+
}
|
|
48650
|
+
}
|
|
48651
|
+
const newCourt = courtRecord;
|
|
48652
|
+
venue.courts.push(newCourt);
|
|
48653
|
+
if (!disableNotice) {
|
|
48654
|
+
addNotice({
|
|
48655
|
+
payload: { venue, tournamentId: tournamentRecord.tournamentId },
|
|
48656
|
+
topic: MODIFY_VENUE,
|
|
48657
|
+
key: venue.venueId,
|
|
48658
|
+
});
|
|
48659
|
+
}
|
|
48660
|
+
return { ...SUCCESS, court: makeDeepCopy(courtRecord), venueId };
|
|
48661
|
+
}
|
|
48662
|
+
}
|
|
48663
|
+
function addCourts(params) {
|
|
48664
|
+
const { tournamentRecord, venueId } = params;
|
|
48665
|
+
if (typeof venueId !== 'string' || !venueId)
|
|
48666
|
+
return { error: MISSING_VENUE_ID };
|
|
48667
|
+
const tournamentRecords = params.tournamentRecords ??
|
|
48668
|
+
(tournamentRecord && {
|
|
48669
|
+
[tournamentRecord.tournamentId]: tournamentRecord,
|
|
48670
|
+
}) ??
|
|
48671
|
+
{};
|
|
48672
|
+
const courtIds = [];
|
|
48673
|
+
let success;
|
|
48674
|
+
for (const tournamentRecord of Object.values(tournamentRecords)) {
|
|
48675
|
+
const { venue } = findVenue({ tournamentRecord, venueId });
|
|
48676
|
+
if (venue) {
|
|
48677
|
+
const result = courtsAdd({ ...params, tournamentRecord });
|
|
48678
|
+
for (const court of result?.courts ?? []) {
|
|
48679
|
+
courtIds.push(court?.courtId);
|
|
48680
|
+
}
|
|
48681
|
+
if (result.error)
|
|
48682
|
+
return result;
|
|
48683
|
+
success = true;
|
|
48684
|
+
}
|
|
48685
|
+
}
|
|
48686
|
+
return success ? { ...SUCCESS, courtIds } : { error: VENUE_NOT_FOUND };
|
|
48687
|
+
}
|
|
48688
|
+
function courtsAdd({ courtNameRoot = 'Court', dateAvailability = [], venueAbbreviationRoot, tournamentRecord, courtNames = [], courtTimings, courtsCount, startTime, courtIds, endTime, idPrefix, venueId, dates, }) {
|
|
48689
|
+
if (!venueId)
|
|
48690
|
+
return { error: MISSING_VENUE_ID };
|
|
48691
|
+
const result = findVenue({ tournamentRecord, venueId });
|
|
48692
|
+
if (result.error)
|
|
48693
|
+
return result;
|
|
48694
|
+
const { venue } = result;
|
|
48695
|
+
if (!isNumeric(courtsCount) || !courtNames)
|
|
48696
|
+
return { error: MISSING_COURTS_INFO };
|
|
48697
|
+
courtsCount = courtsCount ?? courtNames.length;
|
|
48698
|
+
const courts = generateRange(0, courtsCount).map((i) => {
|
|
48699
|
+
const courtTiming = courtTimings?.[i];
|
|
48700
|
+
const courtAvailability = courtTiming
|
|
48701
|
+
? dates.map((date) => ({
|
|
48702
|
+
date: formatDate(date),
|
|
48703
|
+
startTime,
|
|
48704
|
+
endTime,
|
|
48705
|
+
...courtTiming,
|
|
48706
|
+
}))
|
|
48707
|
+
: dateAvailability;
|
|
48708
|
+
if (courtTiming && startTime && endTime)
|
|
48709
|
+
courtAvailability.push({ startTime, endTime });
|
|
48710
|
+
return {
|
|
48711
|
+
courtName: courtNames[i] ||
|
|
48712
|
+
(venueAbbreviationRoot && venue?.venueAbbreviation && `${venue?.venueAbbreviation} ${i + 1}`) ||
|
|
48713
|
+
`${courtNameRoot} ${i + 1}`,
|
|
48714
|
+
dateAvailability: courtAvailability,
|
|
48715
|
+
};
|
|
48716
|
+
});
|
|
48717
|
+
const mapResult = courts.map((court, i) => {
|
|
48718
|
+
const courtId = courtIds?.pop() || (idPrefix && `${idPrefix}-${i + 1}`);
|
|
48719
|
+
return addCourt({
|
|
48720
|
+
disableNotice: true,
|
|
48721
|
+
tournamentRecord,
|
|
48722
|
+
courtId,
|
|
48723
|
+
venueId,
|
|
48724
|
+
court,
|
|
48725
|
+
});
|
|
48726
|
+
});
|
|
48727
|
+
const courtRecords = mapResult.map((outcome) => outcome.court).filter(Boolean);
|
|
48728
|
+
if (courtRecords.length !== courtsCount) {
|
|
48729
|
+
return decorateResult({
|
|
48730
|
+
info: 'not all courts could be generated',
|
|
48731
|
+
result: { error: INVALID_VALUES },
|
|
48732
|
+
});
|
|
48733
|
+
}
|
|
48734
|
+
if (venue)
|
|
48735
|
+
addNotice({
|
|
48736
|
+
payload: { venue, tournamentId: tournamentRecord.tournamentId },
|
|
48737
|
+
topic: MODIFY_VENUE,
|
|
48738
|
+
key: venue.venueId,
|
|
48739
|
+
});
|
|
48740
|
+
return { ...SUCCESS, courts: makeDeepCopy(courtRecords) };
|
|
48741
|
+
}
|
|
48742
|
+
|
|
48743
|
+
function generateVenues({ tournamentRecord, venueProfiles, uuids }) {
|
|
48744
|
+
const { startDate, endDate } = tournamentRecord;
|
|
48745
|
+
const venueIds = [];
|
|
48746
|
+
for (const [index, venueProfile] of venueProfiles.entries()) {
|
|
48747
|
+
const { venueAbbreviation, venueId = uuids?.pop() ?? UUID(), dateAvailability, startTime = '07:00', endTime = '19:00', courtTimings, courtsCount, courtNames, venueName, idPrefix, courtIds, } = venueProfile;
|
|
48748
|
+
const newVenue = {
|
|
48749
|
+
venueName: venueName || `Venue ${index + 1}`,
|
|
48750
|
+
venueAbbreviation,
|
|
48751
|
+
venueId,
|
|
48752
|
+
};
|
|
48753
|
+
const result = addVenue({ tournamentRecord, venue: newVenue });
|
|
48754
|
+
if (result.error)
|
|
48755
|
+
return result;
|
|
48756
|
+
venueIds.push(venueId);
|
|
48757
|
+
const dates = generateDateRange(startDate, endDate);
|
|
48758
|
+
const generatedDateAvailability = !Array.isArray(dateAvailability) &&
|
|
48759
|
+
[{ startTime, endTime }].concat(dates.map((date) => ({
|
|
48760
|
+
date: formatDate(date),
|
|
48761
|
+
startTime,
|
|
48762
|
+
endTime,
|
|
48763
|
+
})));
|
|
48764
|
+
const addResult = addCourts({
|
|
48765
|
+
dateAvailability: dateAvailability || generatedDateAvailability,
|
|
48766
|
+
tournamentRecord,
|
|
48767
|
+
courtTimings,
|
|
48768
|
+
courtsCount,
|
|
48769
|
+
courtNames,
|
|
48770
|
+
startTime,
|
|
48771
|
+
idPrefix,
|
|
48772
|
+
courtIds,
|
|
48773
|
+
endTime,
|
|
48774
|
+
venueId,
|
|
48775
|
+
dates,
|
|
48776
|
+
});
|
|
48777
|
+
if (addResult.error)
|
|
48778
|
+
return addResult;
|
|
48779
|
+
}
|
|
48780
|
+
return venueIds;
|
|
48781
|
+
}
|
|
48782
|
+
|
|
48690
48783
|
const mockTournamentNames = [
|
|
48691
48784
|
'Mock Tournament',
|
|
48692
48785
|
'CourtHive Challenge',
|
|
@@ -50602,20 +50695,7 @@ function getAllEventData({ tournamentRecord, policyDefinitions }) {
|
|
|
50602
50695
|
});
|
|
50603
50696
|
const eventsData = events.map((event) => {
|
|
50604
50697
|
const { eventId } = event;
|
|
50605
|
-
const eventInfo = (
|
|
50606
|
-
eventId,
|
|
50607
|
-
eventName,
|
|
50608
|
-
eventType,
|
|
50609
|
-
eventLevel,
|
|
50610
|
-
surfaceCategory,
|
|
50611
|
-
matchUpFormat,
|
|
50612
|
-
category,
|
|
50613
|
-
gender,
|
|
50614
|
-
startDate,
|
|
50615
|
-
endDate,
|
|
50616
|
-
ballType,
|
|
50617
|
-
discipline,
|
|
50618
|
-
}))(event);
|
|
50698
|
+
const eventInfo = extractEventInfo({ event }).eventInfo;
|
|
50619
50699
|
const scheduleTiming = getScheduleTiming({
|
|
50620
50700
|
tournamentRecord,
|
|
50621
50701
|
event,
|
|
@@ -50668,7 +50748,6 @@ var query = {
|
|
|
50668
50748
|
getEventData: getEventData,
|
|
50669
50749
|
getEventPublishStatus: getEventPublishStatus,
|
|
50670
50750
|
getPublishState: getPublishState,
|
|
50671
|
-
getTournamentPublishStatus: getTournamentPublishStatus,
|
|
50672
50751
|
getVenueData: getVenueData
|
|
50673
50752
|
};
|
|
50674
50753
|
|
|
@@ -50681,7 +50760,6 @@ var index$7 = {
|
|
|
50681
50760
|
getEventData: getEventData,
|
|
50682
50761
|
getEventPublishStatus: getEventPublishStatus,
|
|
50683
50762
|
getPublishState: getPublishState,
|
|
50684
|
-
getTournamentPublishStatus: getTournamentPublishStatus,
|
|
50685
50763
|
getVenueData: getVenueData,
|
|
50686
50764
|
mutate: mutate$4,
|
|
50687
50765
|
publishEvent: publishEvent,
|