tods-competition-factory 2.1.2 → 2.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +5 -5
- package/dist/tods-competition-factory.d.ts +4 -4
- package/dist/tods-competition-factory.development.cjs.js +40 -14
- 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 +4 -4
|
@@ -6787,6 +6787,7 @@ type GetParticipantsArgs = {
|
|
|
6787
6787
|
scheduleAnalysis?: ScheduleAnalysis;
|
|
6788
6788
|
policyDefinitions?: PolicyDefinitions;
|
|
6789
6789
|
withPotentialMatchUps?: boolean;
|
|
6790
|
+
returnParticipantMap?: boolean;
|
|
6790
6791
|
contextProfile?: ContextProfile;
|
|
6791
6792
|
tournamentRecord: Tournament;
|
|
6792
6793
|
withRankingProfile?: boolean;
|
|
@@ -6796,6 +6797,7 @@ type GetParticipantsArgs = {
|
|
|
6796
6797
|
withTeamMatchUps?: boolean;
|
|
6797
6798
|
withScaleValues?: boolean;
|
|
6798
6799
|
usePublishState?: boolean;
|
|
6800
|
+
returnMatchUps?: boolean;
|
|
6799
6801
|
withStatistics?: boolean;
|
|
6800
6802
|
withOpponents?: boolean;
|
|
6801
6803
|
withMatchUps?: boolean;
|
|
@@ -6812,6 +6814,7 @@ declare function getParticipants(params: GetParticipantsArgs): {
|
|
|
6812
6814
|
};
|
|
6813
6815
|
participantIdsWithConflicts?: string[];
|
|
6814
6816
|
participants?: HydratedParticipant[];
|
|
6817
|
+
missingParticipantIds?: string[];
|
|
6815
6818
|
participantMap?: ParticipantMap;
|
|
6816
6819
|
derivedEventInfo?: any;
|
|
6817
6820
|
derivedDrawInfo?: any;
|
|
@@ -7373,10 +7376,7 @@ declare function analyzeTournament({ tournamentRecord }: {
|
|
|
7373
7376
|
code: string;
|
|
7374
7377
|
};
|
|
7375
7378
|
} | {
|
|
7376
|
-
analysis:
|
|
7377
|
-
isDual: boolean;
|
|
7378
|
-
drawsAnalysis: any;
|
|
7379
|
-
};
|
|
7379
|
+
analysis: any;
|
|
7380
7380
|
success: boolean;
|
|
7381
7381
|
error?: undefined;
|
|
7382
7382
|
};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
function factoryVersion() {
|
|
6
|
-
return '2.1.
|
|
6
|
+
return '2.1.4';
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
function isFunction(obj) {
|
|
@@ -174,6 +174,10 @@ const DRAW_POSITION_ACTIVE = {
|
|
|
174
174
|
message: 'drawPosition is active',
|
|
175
175
|
code: 'ERR_ACTIVE_DRAW_POSITION',
|
|
176
176
|
};
|
|
177
|
+
const DRAW_POSITION_OCCUPIED = {
|
|
178
|
+
message: 'drawPosition is occupied',
|
|
179
|
+
code: 'ERR_OCCUPIED_DRAW_POSITION',
|
|
180
|
+
};
|
|
177
181
|
const INVALID_DRAW_POSITION = {
|
|
178
182
|
message: 'Invlid drawPosition',
|
|
179
183
|
code: 'ERR_INVALID_DRAW_POSITION',
|
|
@@ -5697,7 +5701,7 @@ function getTimeItem(params) {
|
|
|
5697
5701
|
const bDate = new Date(b.createdAt || undefined).getTime();
|
|
5698
5702
|
return aDate - bDate;
|
|
5699
5703
|
});
|
|
5700
|
-
const timeItem = filteredSorted.pop();
|
|
5704
|
+
const timeItem = makeDeepCopy(filteredSorted.pop(), false, true);
|
|
5701
5705
|
if (timeItem) {
|
|
5702
5706
|
const result = { timeItem, ...SUCCESS };
|
|
5703
5707
|
if (returnPreviousValues)
|
|
@@ -5777,6 +5781,7 @@ const membershipMap = {
|
|
|
5777
5781
|
[TEAM]: 'teams',
|
|
5778
5782
|
};
|
|
5779
5783
|
function getParticipantMap({ withIndividualParticipants, convertExtensions, tournamentRecord, withSignInStatus, withScaleValues, internalUse, withISO2, withIOC, }) {
|
|
5784
|
+
const missingParticipantIds = [];
|
|
5780
5785
|
const participantMap = {};
|
|
5781
5786
|
for (const participant of tournamentRecord.participants ?? []) {
|
|
5782
5787
|
const participantId = participant?.participantId;
|
|
@@ -5787,13 +5792,16 @@ function getParticipantMap({ withIndividualParticipants, convertExtensions, tour
|
|
|
5787
5792
|
const { participantId, individualParticipantIds, participantType } = participantCopy;
|
|
5788
5793
|
Object.assign(participantMap[participantId].participant, participantCopy);
|
|
5789
5794
|
if (individualParticipantIds) {
|
|
5790
|
-
processIndividualParticipantIds({
|
|
5795
|
+
const result = processIndividualParticipantIds({
|
|
5791
5796
|
individualParticipantIds,
|
|
5792
5797
|
participantCopy,
|
|
5793
5798
|
participantMap,
|
|
5794
5799
|
participantType,
|
|
5795
5800
|
participantId,
|
|
5796
5801
|
});
|
|
5802
|
+
if (result.missingParticipantIds.length) {
|
|
5803
|
+
missingParticipantIds.push(...result.missingParticipantIds);
|
|
5804
|
+
}
|
|
5797
5805
|
}
|
|
5798
5806
|
if (withSignInStatus) {
|
|
5799
5807
|
participantMap[participantId].participant.signedIn = signedIn(participantCopy);
|
|
@@ -5817,7 +5825,7 @@ function getParticipantMap({ withIndividualParticipants, convertExtensions, tour
|
|
|
5817
5825
|
const template = isObject(withIndividualParticipants) ? withIndividualParticipants : undefined;
|
|
5818
5826
|
addIndividualParticipants({ participantMap, template });
|
|
5819
5827
|
}
|
|
5820
|
-
return { participantMap };
|
|
5828
|
+
return { missingParticipantIds, participantMap };
|
|
5821
5829
|
}
|
|
5822
5830
|
function signedIn(participant) {
|
|
5823
5831
|
const { timeItem } = getTimeItem({
|
|
@@ -5827,8 +5835,13 @@ function signedIn(participant) {
|
|
|
5827
5835
|
return timeItem?.itemValue === SIGNED_IN;
|
|
5828
5836
|
}
|
|
5829
5837
|
function processIndividualParticipantIds({ individualParticipantIds, participantCopy, participantMap, participantType, participantId, }) {
|
|
5838
|
+
const missingParticipantIds = [];
|
|
5830
5839
|
for (const individualParticipantId of individualParticipantIds) {
|
|
5831
|
-
const individualParticipant = participantMap[individualParticipantId]
|
|
5840
|
+
const individualParticipant = participantMap[individualParticipantId]?.participant;
|
|
5841
|
+
if (!individualParticipant) {
|
|
5842
|
+
missingParticipantIds.push(individualParticipantId);
|
|
5843
|
+
continue;
|
|
5844
|
+
}
|
|
5832
5845
|
individualParticipant[typeMap[participantType]].push(participantId);
|
|
5833
5846
|
if ([TEAM, GROUP].includes(participantType)) {
|
|
5834
5847
|
const { participantRoleResponsibilities, participantOtherName, participantName, participantId, teamId } = participantCopy;
|
|
@@ -5847,6 +5860,7 @@ function processIndividualParticipantIds({ individualParticipantIds, participant
|
|
|
5847
5860
|
participantMap[individualParticipantId].pairIdMap[partnerParticipantId] = participantId;
|
|
5848
5861
|
}
|
|
5849
5862
|
}
|
|
5863
|
+
return { missingParticipantIds };
|
|
5850
5864
|
}
|
|
5851
5865
|
function initializeParticipantId({ participantMap, participantId }) {
|
|
5852
5866
|
if (participantMap[participantId])
|
|
@@ -12520,7 +12534,7 @@ function getParticipants(params) {
|
|
|
12520
12534
|
if (withMatchUps || withRankingProfile) {
|
|
12521
12535
|
getMatchUpDependencies({ tournamentRecord });
|
|
12522
12536
|
}
|
|
12523
|
-
|
|
12537
|
+
const mapResult = getParticipantMap({
|
|
12524
12538
|
convertExtensions,
|
|
12525
12539
|
tournamentRecord,
|
|
12526
12540
|
withSignInStatus,
|
|
@@ -12529,6 +12543,7 @@ function getParticipants(params) {
|
|
|
12529
12543
|
withISO2,
|
|
12530
12544
|
withIOC,
|
|
12531
12545
|
});
|
|
12546
|
+
let { participantMap } = mapResult;
|
|
12532
12547
|
const entriesResult = getParticipantEntries({
|
|
12533
12548
|
withMatchUps: withMatchUps ?? withRankingProfile,
|
|
12534
12549
|
withEvents: withEvents ?? withRankingProfile,
|
|
@@ -12600,15 +12615,16 @@ function getParticipants(params) {
|
|
|
12600
12615
|
? filteredParticipants.map((source) => attributeFilter({ source, template }))
|
|
12601
12616
|
: filteredParticipants;
|
|
12602
12617
|
return {
|
|
12618
|
+
participantMap: params.returnParticipantMap !== false ? participantMap : undefined,
|
|
12619
|
+
mappedMatchUps: params.returnMatchUps !== false ? mappedMatchUps : undefined,
|
|
12620
|
+
matchUps: params.returnMatchUps !== false ? matchUps : undefined,
|
|
12621
|
+
missingParticipantIds: mapResult.missingParticipantIds,
|
|
12603
12622
|
participantIdsWithConflicts,
|
|
12604
12623
|
eventsPublishStatuses,
|
|
12605
12624
|
derivedEventInfo,
|
|
12606
12625
|
derivedDrawInfo,
|
|
12607
|
-
mappedMatchUps,
|
|
12608
|
-
participantMap,
|
|
12609
12626
|
participants,
|
|
12610
12627
|
...SUCCESS,
|
|
12611
|
-
matchUps,
|
|
12612
12628
|
};
|
|
12613
12629
|
}
|
|
12614
12630
|
|
|
@@ -22395,9 +22411,10 @@ function directLoser(params) {
|
|
|
22395
22411
|
return decorateResult({ result, stack });
|
|
22396
22412
|
}
|
|
22397
22413
|
else {
|
|
22414
|
+
const error = !targetDrawPositionIsUnfilled ? DRAW_POSITION_OCCUPIED : INVALID_DRAW_POSITION;
|
|
22398
22415
|
return decorateResult({
|
|
22399
|
-
|
|
22400
|
-
|
|
22416
|
+
context: { loserDrawPosition, loserTargetLink, targetDrawPositionIsUnfilled },
|
|
22417
|
+
result: { error },
|
|
22401
22418
|
stack,
|
|
22402
22419
|
});
|
|
22403
22420
|
}
|
|
@@ -22906,7 +22923,11 @@ function addTournamentTimeItem(params) {
|
|
|
22906
22923
|
return result;
|
|
22907
22924
|
const timeItemValues = getTimeItemValues({ element: tournamentRecord });
|
|
22908
22925
|
addNotice({
|
|
22909
|
-
payload: {
|
|
22926
|
+
payload: {
|
|
22927
|
+
parentOrganisation: tournamentRecord.parentOrganisation,
|
|
22928
|
+
tournamentId: tournamentRecord.tournamentId,
|
|
22929
|
+
timeItemValues,
|
|
22930
|
+
},
|
|
22910
22931
|
topic: MODIFY_TOURNAMENT_DETAIL,
|
|
22911
22932
|
});
|
|
22912
22933
|
return result;
|
|
@@ -33670,11 +33691,12 @@ function getTournamentInfo(params) {
|
|
|
33670
33691
|
notes,
|
|
33671
33692
|
updatedAt,
|
|
33672
33693
|
}))(tournamentRecord);
|
|
33673
|
-
const
|
|
33694
|
+
const participantResult = getParticipants({
|
|
33674
33695
|
participantFilters: { participantRoles: [ADMINISTRATION, OFFICIAL, MEDIA, MEDICAL, SECURITY] },
|
|
33675
33696
|
policyDefinitions: POLICY_PRIVACY_STAFF,
|
|
33676
33697
|
tournamentRecord,
|
|
33677
|
-
})
|
|
33698
|
+
});
|
|
33699
|
+
const tournamentContacts = participantResult?.participants ?? [];
|
|
33678
33700
|
if (tournamentContacts)
|
|
33679
33701
|
tournamentInfo.tournamentContacts = tournamentContacts;
|
|
33680
33702
|
const publishState = getPublishState({ tournamentRecord })?.publishState;
|
|
@@ -33770,6 +33792,10 @@ function analyzeTournament({ tournamentRecord }) {
|
|
|
33770
33792
|
isDual: checkIsDual(tournamentRecord),
|
|
33771
33793
|
drawsAnalysis,
|
|
33772
33794
|
};
|
|
33795
|
+
const participantResult = getParticipants({ tournamentRecord });
|
|
33796
|
+
if (participantResult.missingParticipantIds?.length) {
|
|
33797
|
+
analysis.missingParticipantIds = participantResult.missingParticipantIds;
|
|
33798
|
+
}
|
|
33773
33799
|
return { ...SUCCESS, analysis };
|
|
33774
33800
|
}
|
|
33775
33801
|
|