tods-competition-factory 1.8.30 → 1.8.32
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/forge/generate.d.ts +2 -0
- package/dist/forge/generate.mjs +167 -36
- package/dist/forge/generate.mjs.map +1 -1
- package/dist/forge/query.d.ts +33 -2
- package/dist/forge/query.mjs +248 -74
- package/dist/forge/query.mjs.map +1 -1
- package/dist/forge/transform.mjs +152 -33
- package/dist/forge/transform.mjs.map +1 -1
- package/dist/index.mjs +264 -78
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +291 -105
- 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 +2 -2
package/dist/forge/query.d.ts
CHANGED
|
@@ -1601,6 +1601,12 @@ type GetMatchUpsArgs = {
|
|
|
1601
1601
|
inContext?: boolean;
|
|
1602
1602
|
event?: Event;
|
|
1603
1603
|
};
|
|
1604
|
+
type GroupInfo = {
|
|
1605
|
+
[key: string]: {
|
|
1606
|
+
participantName: string;
|
|
1607
|
+
participantId: string;
|
|
1608
|
+
};
|
|
1609
|
+
};
|
|
1604
1610
|
type GroupsMatchUpsResult = {
|
|
1605
1611
|
abandonedMatchUps?: HydratedMatchUp[];
|
|
1606
1612
|
completedMatchUps?: HydratedMatchUp[];
|
|
@@ -1609,6 +1615,7 @@ type GroupsMatchUpsResult = {
|
|
|
1609
1615
|
byeMatchUps?: HydratedMatchUp[];
|
|
1610
1616
|
matchUpsMap?: MatchUpsMap;
|
|
1611
1617
|
matchUpsCount?: number;
|
|
1618
|
+
groupInfo?: GroupInfo;
|
|
1612
1619
|
success?: boolean;
|
|
1613
1620
|
error?: ErrorType;
|
|
1614
1621
|
};
|
|
@@ -2207,12 +2214,23 @@ declare function competitionMatchUps({ scheduleVisibilityFilters, participantsPr
|
|
|
2207
2214
|
upcomingMatchUps?: HydratedMatchUp[];
|
|
2208
2215
|
pendingMatchUps?: HydratedMatchUp[];
|
|
2209
2216
|
byeMatchUps?: HydratedMatchUp[];
|
|
2217
|
+
groupInfo?: GroupInfo;
|
|
2210
2218
|
};
|
|
2211
2219
|
|
|
2212
2220
|
declare function allTournamentMatchUps(params?: GetMatchUpsArgs): ResultType & {
|
|
2213
2221
|
matchUps?: HydratedMatchUp[];
|
|
2214
2222
|
};
|
|
2215
|
-
declare function allDrawMatchUps(params: GetMatchUpsArgs):
|
|
2223
|
+
declare function allDrawMatchUps(params: GetMatchUpsArgs): {
|
|
2224
|
+
groupInfo: any;
|
|
2225
|
+
context?: {
|
|
2226
|
+
[key: string]: any;
|
|
2227
|
+
} | undefined;
|
|
2228
|
+
stack?: string | string[] | undefined;
|
|
2229
|
+
error?: ErrorType | undefined;
|
|
2230
|
+
errors?: string[] | undefined;
|
|
2231
|
+
success?: boolean | undefined;
|
|
2232
|
+
valid?: boolean | undefined;
|
|
2233
|
+
info?: any;
|
|
2216
2234
|
matchUps?: HydratedMatchUp[] | undefined;
|
|
2217
2235
|
matchUpsMap?: MatchUpsMap | undefined;
|
|
2218
2236
|
};
|
|
@@ -2222,12 +2240,25 @@ declare function allEventMatchUps(params: GetMatchUpsArgs): {
|
|
|
2222
2240
|
code: string;
|
|
2223
2241
|
};
|
|
2224
2242
|
matchUps?: undefined;
|
|
2243
|
+
groupInfo?: undefined;
|
|
2225
2244
|
} | {
|
|
2226
2245
|
matchUps: HydratedMatchUp[];
|
|
2246
|
+
groupInfo: any;
|
|
2227
2247
|
error?: undefined;
|
|
2228
2248
|
};
|
|
2229
2249
|
declare function tournamentMatchUps(params: GetMatchUpsArgs): GroupsMatchUpsResult;
|
|
2230
2250
|
declare function eventMatchUps(params: GetMatchUpsArgs): GroupsMatchUpsResult;
|
|
2231
|
-
declare function drawMatchUps({ participants: tournamentParticipants, tournamentAppliedPolicies, scheduleVisibilityFilters, participantsProfile, afterRecoveryTimes, policyDefinitions, useParticipantMap, tournamentRecord, contextFilters, contextProfile, contextContent, drawDefinition, matchUpFilters, participantMap, nextMatchUps, tournamentId, inContext, context, event, }: GetMatchUpsArgs):
|
|
2251
|
+
declare function drawMatchUps({ participants: tournamentParticipants, tournamentAppliedPolicies, scheduleVisibilityFilters, participantsProfile, afterRecoveryTimes, policyDefinitions, useParticipantMap, tournamentRecord, contextFilters, contextProfile, contextContent, drawDefinition, matchUpFilters, participantMap, nextMatchUps, tournamentId, inContext, context, event, }: GetMatchUpsArgs): {
|
|
2252
|
+
groupInfo: any;
|
|
2253
|
+
abandonedMatchUps?: HydratedMatchUp[] | undefined;
|
|
2254
|
+
completedMatchUps?: HydratedMatchUp[] | undefined;
|
|
2255
|
+
upcomingMatchUps?: HydratedMatchUp[] | undefined;
|
|
2256
|
+
pendingMatchUps?: HydratedMatchUp[] | undefined;
|
|
2257
|
+
byeMatchUps?: HydratedMatchUp[] | undefined;
|
|
2258
|
+
matchUpsMap?: MatchUpsMap | undefined;
|
|
2259
|
+
matchUpsCount?: number | undefined;
|
|
2260
|
+
success?: boolean | undefined;
|
|
2261
|
+
error?: ErrorType | undefined;
|
|
2262
|
+
};
|
|
2232
2263
|
|
|
2233
2264
|
export { allCompetitionMatchUps, allDrawMatchUps, allEventMatchUps, allTournamentMatchUps, matchUpActions$1 as competitionMatchUpActions, competitionMatchUps, competitionScheduleMatchUps, drawMatchUps, eventMatchUps, filterParticipants, findExtension, findMatchUp, publicFindParticipant as findParticipant, generateSeedingScaleItems, getAssignedParticipantIds, getCompetitionDateRange, getCompetitionParticipants, getCompetitionVenues, getVenuesAndCourts$1 as getCompetitionVenuesAndCourts, getEligibleVoluntaryConsolationParticipants, getEntriesAndSeedsCount, getEventData, getEventMatchUpFormatTiming, getFlightProfile, getMatchUpDailyLimits, getMatchUpDailyLimitsUpdate, getMatchUpFormatTimingUpdate, getOrderedDrawPositions, getParticipantEventDetails, getParticipantScaleItem, getPolicyDefinitions, getPositionAssignments, getProfileRounds, getRoundContextProfile, getRoundMatchUps, getRounds, getSeedsCount, getTimeItem, getVenuesAndCourts as getTournamentVenuesAndCourts, getValidGroupSizes, isValid as isValidMatchUpFormat, parse as parseMatchUpFormat, parseScoreString, participantScaleItem, positionActions, matchUpActions as tournamentMatchUpActions, tournamentMatchUps, validateScore };
|
package/dist/forge/query.mjs
CHANGED
|
@@ -1704,13 +1704,12 @@ const SIGNED_IN = "SIGNED_IN" /* SIGNED_IN */;
|
|
|
1704
1704
|
|
|
1705
1705
|
function addParticipantGroupings({
|
|
1706
1706
|
participantsProfile,
|
|
1707
|
-
participants = []
|
|
1707
|
+
participants = [],
|
|
1708
|
+
deepCopy
|
|
1709
|
+
// will skip deepCopy only if false
|
|
1708
1710
|
}) {
|
|
1709
|
-
const
|
|
1710
|
-
|
|
1711
|
-
participantsProfile?.convertExtensions,
|
|
1712
|
-
true
|
|
1713
|
-
);
|
|
1711
|
+
const groupMap = /* @__PURE__ */ new Map();
|
|
1712
|
+
const participantsWithGroupings = deepCopy !== false ? makeDeepCopy(participants, participantsProfile?.convertExtensions, true) : participants;
|
|
1714
1713
|
const teamParticipants = participantsWithGroupings.filter(
|
|
1715
1714
|
(participant) => participant.participantType === TEAM$2
|
|
1716
1715
|
);
|
|
@@ -1733,6 +1732,11 @@ function addParticipantGroupings({
|
|
|
1733
1732
|
(individualParticipantId) => {
|
|
1734
1733
|
if (individualParticipantId === participantId && !participant.teamParticipantIds?.includes(team.participantId)) {
|
|
1735
1734
|
participant.teamParticipantIds.push(team.participantId);
|
|
1735
|
+
if (!groupMap.get(team.participantId))
|
|
1736
|
+
groupMap.set(team.participantId, {
|
|
1737
|
+
participantName: team.participantName,
|
|
1738
|
+
participantId: team.participantId
|
|
1739
|
+
});
|
|
1736
1740
|
participant.teams.push({
|
|
1737
1741
|
participantRoleResponsibilities: team.participantRoleResponsibilities,
|
|
1738
1742
|
participantOtherName: team.participantOtherName,
|
|
@@ -1770,7 +1774,7 @@ function addParticipantGroupings({
|
|
|
1770
1774
|
});
|
|
1771
1775
|
}
|
|
1772
1776
|
});
|
|
1773
|
-
return participantsWithGroupings;
|
|
1777
|
+
return { participantsWithGroupings, groupInfo: Object.fromEntries(groupMap) };
|
|
1774
1778
|
}
|
|
1775
1779
|
|
|
1776
1780
|
const countries = [
|
|
@@ -3797,11 +3801,13 @@ function hydrateParticipants({
|
|
|
3797
3801
|
participants.forEach(
|
|
3798
3802
|
(participant) => addNationalityCode({ participant, ...participantsProfile })
|
|
3799
3803
|
);
|
|
3804
|
+
let groupInfo;
|
|
3800
3805
|
if ((inContext || participantsProfile?.withGroupings) && participants?.length) {
|
|
3801
|
-
participants = addParticipantGroupings({
|
|
3806
|
+
({ participantsWithGroupings: participants, groupInfo } = addParticipantGroupings({
|
|
3802
3807
|
participantsProfile,
|
|
3808
|
+
deepCopy: false,
|
|
3803
3809
|
participants
|
|
3804
|
-
});
|
|
3810
|
+
}));
|
|
3805
3811
|
}
|
|
3806
3812
|
if (participantsProfile?.withScaleValues && participants?.length) {
|
|
3807
3813
|
for (const participant of participants) {
|
|
@@ -3810,7 +3816,7 @@ function hydrateParticipants({
|
|
|
3810
3816
|
participant.ratings = ratings;
|
|
3811
3817
|
}
|
|
3812
3818
|
}
|
|
3813
|
-
return { participants };
|
|
3819
|
+
return { participants, groupInfo };
|
|
3814
3820
|
}
|
|
3815
3821
|
|
|
3816
3822
|
const WALKOVER = "WALKOVER";
|
|
@@ -7598,13 +7604,14 @@ function getDrawMatchUps(params) {
|
|
|
7598
7604
|
event
|
|
7599
7605
|
});
|
|
7600
7606
|
}
|
|
7607
|
+
let groupInfo;
|
|
7601
7608
|
if (!tournamentParticipants?.length && tournamentRecord) {
|
|
7602
7609
|
tournamentParticipants = tournamentRecord?.participants;
|
|
7603
7610
|
if ((inContext || participantsProfile?.withGroupings) && tournamentParticipants?.length) {
|
|
7604
|
-
tournamentParticipants = addParticipantGroupings({
|
|
7611
|
+
({ participantsWithGroupings: tournamentParticipants, groupInfo } = addParticipantGroupings({
|
|
7605
7612
|
participants: tournamentParticipants,
|
|
7606
7613
|
participantsProfile
|
|
7607
|
-
});
|
|
7614
|
+
}));
|
|
7608
7615
|
}
|
|
7609
7616
|
}
|
|
7610
7617
|
const { structures } = getDrawStructures({ drawDefinition });
|
|
@@ -7665,14 +7672,15 @@ function getDrawMatchUps(params) {
|
|
|
7665
7672
|
}
|
|
7666
7673
|
return matchUps;
|
|
7667
7674
|
};
|
|
7668
|
-
const
|
|
7675
|
+
const drawMatchUpsResult = {
|
|
7669
7676
|
abandonedMatchUps: applyFilter(allAbandonedMatchUps),
|
|
7670
7677
|
completedMatchUps: applyFilter(allCompletedMatchUps),
|
|
7671
7678
|
upcomingMatchUps: applyFilter(allUpcomingMatchUps),
|
|
7672
7679
|
pendingMatchUps: applyFilter(allPendingMatchUps),
|
|
7673
7680
|
byeMatchUps: applyFilter(allByeMatchUps),
|
|
7674
7681
|
matchUpsMap,
|
|
7675
|
-
...SUCCESS
|
|
7682
|
+
...SUCCESS,
|
|
7683
|
+
groupInfo
|
|
7676
7684
|
};
|
|
7677
7685
|
if (nextMatchUps) {
|
|
7678
7686
|
const nextFilter = typeof nextMatchUps === "object" || {
|
|
@@ -7695,7 +7703,7 @@ function getDrawMatchUps(params) {
|
|
|
7695
7703
|
drawDefinition
|
|
7696
7704
|
});
|
|
7697
7705
|
}
|
|
7698
|
-
return
|
|
7706
|
+
return drawMatchUpsResult;
|
|
7699
7707
|
}
|
|
7700
7708
|
|
|
7701
7709
|
function allTournamentMatchUps(params) {
|
|
@@ -7803,8 +7811,13 @@ function allDrawMatchUps(params) {
|
|
|
7803
7811
|
surfaceCategory: event?.surfaceCategory ?? tournamentRecord?.surfaceCategory,
|
|
7804
7812
|
endDate: event?.endDate
|
|
7805
7813
|
};
|
|
7814
|
+
let groupInfo;
|
|
7806
7815
|
if (!tournamentParticipants?.length && !participantMap && tournamentRecord) {
|
|
7807
|
-
({
|
|
7816
|
+
({
|
|
7817
|
+
participants: tournamentParticipants = [],
|
|
7818
|
+
participantMap,
|
|
7819
|
+
groupInfo
|
|
7820
|
+
} = hydrateParticipants({
|
|
7808
7821
|
participantsProfile,
|
|
7809
7822
|
useParticipantMap,
|
|
7810
7823
|
policyDefinitions,
|
|
@@ -7822,7 +7835,7 @@ function allDrawMatchUps(params) {
|
|
|
7822
7835
|
event
|
|
7823
7836
|
});
|
|
7824
7837
|
}
|
|
7825
|
-
|
|
7838
|
+
const allDrawMatchUpsResult = getAllDrawMatchUps({
|
|
7826
7839
|
context: additionalContext,
|
|
7827
7840
|
tournamentAppliedPolicies,
|
|
7828
7841
|
scheduleVisibilityFilters,
|
|
@@ -7841,6 +7854,7 @@ function allDrawMatchUps(params) {
|
|
|
7841
7854
|
inContext,
|
|
7842
7855
|
event
|
|
7843
7856
|
});
|
|
7857
|
+
return { ...allDrawMatchUpsResult, groupInfo };
|
|
7844
7858
|
}
|
|
7845
7859
|
function allEventMatchUps(params) {
|
|
7846
7860
|
let { participants = [], contextContent, participantMap } = params;
|
|
@@ -7887,6 +7901,7 @@ function allEventMatchUps(params) {
|
|
|
7887
7901
|
event
|
|
7888
7902
|
});
|
|
7889
7903
|
}
|
|
7904
|
+
let groupInfo;
|
|
7890
7905
|
if (!participants?.length && !participantMap && tournamentRecord) {
|
|
7891
7906
|
const hydratedParticipantResult = hydrateParticipants({
|
|
7892
7907
|
participantsProfile,
|
|
@@ -7898,6 +7913,7 @@ function allEventMatchUps(params) {
|
|
|
7898
7913
|
});
|
|
7899
7914
|
participantMap = hydratedParticipantResult.participantMap;
|
|
7900
7915
|
participants = hydratedParticipantResult.participants ?? [];
|
|
7916
|
+
groupInfo = hydratedParticipantResult.groupInfo;
|
|
7901
7917
|
}
|
|
7902
7918
|
const drawDefinitions = event.drawDefinitions ?? [];
|
|
7903
7919
|
const scheduleTiming = getScheduleTiming({
|
|
@@ -7929,7 +7945,7 @@ function allEventMatchUps(params) {
|
|
|
7929
7945
|
return matchUps2 ?? [];
|
|
7930
7946
|
}
|
|
7931
7947
|
);
|
|
7932
|
-
return { matchUps };
|
|
7948
|
+
return { matchUps, groupInfo };
|
|
7933
7949
|
}
|
|
7934
7950
|
function tournamentMatchUps(params) {
|
|
7935
7951
|
if (!params?.tournamentRecord)
|
|
@@ -7951,7 +7967,7 @@ function tournamentMatchUps(params) {
|
|
|
7951
7967
|
} = params;
|
|
7952
7968
|
const tournamentId = params.tournamentId ?? tournamentRecord.tournamentId;
|
|
7953
7969
|
const events = tournamentRecord?.events ?? [];
|
|
7954
|
-
const { participants, participantMap } = hydrateParticipants({
|
|
7970
|
+
const { participants, participantMap, groupInfo } = hydrateParticipants({
|
|
7955
7971
|
participantsProfile,
|
|
7956
7972
|
policyDefinitions,
|
|
7957
7973
|
useParticipantMap,
|
|
@@ -7995,21 +8011,24 @@ function tournamentMatchUps(params) {
|
|
|
7995
8011
|
event
|
|
7996
8012
|
});
|
|
7997
8013
|
});
|
|
7998
|
-
|
|
8014
|
+
const eventsDrawMatchUpsResult = eventsDrawsMatchUps.reduce(
|
|
7999
8015
|
(matchUps, eventMatchUps2) => {
|
|
8000
8016
|
const keys = eventMatchUps2 && Object.keys(eventMatchUps2).filter(
|
|
8001
8017
|
(key) => !["success", "matchUpsMap"].includes(key)
|
|
8002
8018
|
);
|
|
8003
8019
|
keys?.forEach((key) => {
|
|
8004
|
-
if (
|
|
8005
|
-
matchUps[key]
|
|
8006
|
-
|
|
8007
|
-
|
|
8020
|
+
if (Array.isArray(eventMatchUps2[key])) {
|
|
8021
|
+
if (!matchUps[key])
|
|
8022
|
+
matchUps[key] = [];
|
|
8023
|
+
matchUps[key] = matchUps[key].concat(eventMatchUps2[key]);
|
|
8024
|
+
matchUps.matchUpsCount += eventMatchUps2[key].length;
|
|
8025
|
+
}
|
|
8008
8026
|
});
|
|
8009
8027
|
return matchUps;
|
|
8010
8028
|
},
|
|
8011
8029
|
{ matchUpsCount: 0 }
|
|
8012
8030
|
);
|
|
8031
|
+
return { ...eventsDrawMatchUpsResult, groupInfo };
|
|
8013
8032
|
}
|
|
8014
8033
|
function eventMatchUps(params) {
|
|
8015
8034
|
let {
|
|
@@ -8048,8 +8067,13 @@ function eventMatchUps(params) {
|
|
|
8048
8067
|
surfaceCategory: event.surfaceCategory ?? tournamentRecord?.surfaceCategory
|
|
8049
8068
|
})
|
|
8050
8069
|
};
|
|
8070
|
+
let groupInfo;
|
|
8051
8071
|
if (!tournamentParticipants && tournamentRecord) {
|
|
8052
|
-
({
|
|
8072
|
+
({
|
|
8073
|
+
participants: tournamentParticipants,
|
|
8074
|
+
participantMap,
|
|
8075
|
+
groupInfo
|
|
8076
|
+
} = hydrateParticipants({
|
|
8053
8077
|
participantsProfile,
|
|
8054
8078
|
policyDefinitions,
|
|
8055
8079
|
useParticipantMap,
|
|
@@ -8066,8 +8090,8 @@ function eventMatchUps(params) {
|
|
|
8066
8090
|
event
|
|
8067
8091
|
});
|
|
8068
8092
|
const drawDefinitions = event.drawDefinitions ?? [];
|
|
8069
|
-
|
|
8070
|
-
const
|
|
8093
|
+
const eventResult = drawDefinitions.reduce((results, drawDefinition) => {
|
|
8094
|
+
const drawMatchUpsResult = getDrawMatchUps({
|
|
8071
8095
|
context: additionalContext,
|
|
8072
8096
|
tournamentAppliedPolicies,
|
|
8073
8097
|
scheduleVisibilityFilters,
|
|
@@ -8086,14 +8110,17 @@ function eventMatchUps(params) {
|
|
|
8086
8110
|
inContext,
|
|
8087
8111
|
event
|
|
8088
8112
|
});
|
|
8089
|
-
const keys = Object.keys(
|
|
8113
|
+
const keys = Object.keys(drawMatchUpsResult);
|
|
8090
8114
|
keys?.forEach((key) => {
|
|
8091
|
-
if (
|
|
8092
|
-
|
|
8093
|
-
|
|
8115
|
+
if (Array.isArray(drawMatchUpsResult[key])) {
|
|
8116
|
+
if (!results[key])
|
|
8117
|
+
results[key] = [];
|
|
8118
|
+
results[key] = results[key].concat(drawMatchUpsResult[key]);
|
|
8119
|
+
}
|
|
8094
8120
|
});
|
|
8095
|
-
return
|
|
8121
|
+
return results;
|
|
8096
8122
|
}, {});
|
|
8123
|
+
return { ...eventResult, ...SUCCESS, groupInfo };
|
|
8097
8124
|
}
|
|
8098
8125
|
function drawMatchUps({
|
|
8099
8126
|
participants: tournamentParticipants,
|
|
@@ -8128,8 +8155,13 @@ function drawMatchUps({
|
|
|
8128
8155
|
surfaceCategory: event?.surfaceCategory ?? tournamentRecord?.surfaceCategory
|
|
8129
8156
|
})
|
|
8130
8157
|
};
|
|
8158
|
+
let groupInfo;
|
|
8131
8159
|
if (!tournamentParticipants?.length && tournamentRecord) {
|
|
8132
|
-
({
|
|
8160
|
+
({
|
|
8161
|
+
participants: tournamentParticipants,
|
|
8162
|
+
participantMap,
|
|
8163
|
+
groupInfo
|
|
8164
|
+
} = hydrateParticipants({
|
|
8133
8165
|
participantsProfile,
|
|
8134
8166
|
policyDefinitions,
|
|
8135
8167
|
useParticipantMap,
|
|
@@ -8146,7 +8178,7 @@ function drawMatchUps({
|
|
|
8146
8178
|
drawDefinition,
|
|
8147
8179
|
event
|
|
8148
8180
|
});
|
|
8149
|
-
|
|
8181
|
+
const drawMatchUpsResult = getDrawMatchUps({
|
|
8150
8182
|
context: additionalContext,
|
|
8151
8183
|
tournamentAppliedPolicies,
|
|
8152
8184
|
scheduleVisibilityFilters,
|
|
@@ -8165,6 +8197,7 @@ function drawMatchUps({
|
|
|
8165
8197
|
inContext,
|
|
8166
8198
|
event
|
|
8167
8199
|
});
|
|
8200
|
+
return { ...drawMatchUpsResult, groupInfo };
|
|
8168
8201
|
}
|
|
8169
8202
|
|
|
8170
8203
|
function getEligibleVoluntaryConsolationParticipants({
|
|
@@ -8490,10 +8523,10 @@ function findMatchUp({
|
|
|
8490
8523
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
8491
8524
|
if (typeof matchUpId !== "string")
|
|
8492
8525
|
return { error: MISSING_MATCHUP_ID };
|
|
8493
|
-
if (!drawDefinition || !event
|
|
8526
|
+
if (!drawDefinition || !event) {
|
|
8494
8527
|
const matchUps = allTournamentMatchUps({ tournamentRecord, nextMatchUps }).matchUps ?? [];
|
|
8495
8528
|
const inContextMatchUp = matchUps.find(
|
|
8496
|
-
(
|
|
8529
|
+
(matchUp) => matchUp.matchUpId === matchUpId
|
|
8497
8530
|
);
|
|
8498
8531
|
if (!inContextMatchUp)
|
|
8499
8532
|
return { error: MATCHUP_NOT_FOUND };
|
|
@@ -8522,18 +8555,41 @@ function findMatchUp({
|
|
|
8522
8555
|
contextProfile,
|
|
8523
8556
|
inContext
|
|
8524
8557
|
});
|
|
8525
|
-
|
|
8526
|
-
|
|
8527
|
-
|
|
8528
|
-
|
|
8529
|
-
|
|
8530
|
-
|
|
8531
|
-
|
|
8532
|
-
|
|
8533
|
-
|
|
8534
|
-
|
|
8535
|
-
|
|
8536
|
-
|
|
8558
|
+
if (nextMatchUps) {
|
|
8559
|
+
const matchUps = allDrawMatchUps({
|
|
8560
|
+
context: inContext ? additionalContext : void 0,
|
|
8561
|
+
participants: tournamentParticipants,
|
|
8562
|
+
afterRecoveryTimes,
|
|
8563
|
+
contextContent,
|
|
8564
|
+
contextProfile,
|
|
8565
|
+
drawDefinition,
|
|
8566
|
+
nextMatchUps,
|
|
8567
|
+
inContext,
|
|
8568
|
+
event
|
|
8569
|
+
}).matchUps ?? [];
|
|
8570
|
+
const inContextMatchUp = matchUps.find(
|
|
8571
|
+
(matchUp) => matchUp.matchUpId === matchUpId
|
|
8572
|
+
);
|
|
8573
|
+
if (!inContextMatchUp)
|
|
8574
|
+
return { error: MATCHUP_NOT_FOUND };
|
|
8575
|
+
const structure = drawDefinition?.structures?.find(
|
|
8576
|
+
(structure2) => structure2.structureId === inContextMatchUp.structureId
|
|
8577
|
+
);
|
|
8578
|
+
return { drawDefinition, structure, matchUp: inContextMatchUp };
|
|
8579
|
+
} else {
|
|
8580
|
+
const { matchUp, structure } = findDrawMatchUp({
|
|
8581
|
+
context: inContext ? additionalContext : void 0,
|
|
8582
|
+
tournamentParticipants,
|
|
8583
|
+
afterRecoveryTimes,
|
|
8584
|
+
contextContent,
|
|
8585
|
+
drawDefinition,
|
|
8586
|
+
contextProfile,
|
|
8587
|
+
matchUpId,
|
|
8588
|
+
inContext,
|
|
8589
|
+
event
|
|
8590
|
+
});
|
|
8591
|
+
return { matchUp, structure, drawDefinition };
|
|
8592
|
+
}
|
|
8537
8593
|
}
|
|
8538
8594
|
|
|
8539
8595
|
const getTiebreakComplement = (params) => {
|
|
@@ -10935,15 +10991,25 @@ function competitionMatchUps({
|
|
|
10935
10991
|
inContext
|
|
10936
10992
|
});
|
|
10937
10993
|
});
|
|
10938
|
-
|
|
10939
|
-
|
|
10940
|
-
|
|
10941
|
-
|
|
10942
|
-
|
|
10943
|
-
|
|
10944
|
-
|
|
10945
|
-
|
|
10946
|
-
|
|
10994
|
+
const groupInfo = {};
|
|
10995
|
+
const competitionMatchUpsResult = tournamentsMatchUps.reduce(
|
|
10996
|
+
(groupings, matchUpGroupings) => {
|
|
10997
|
+
const keys = Object.keys(matchUpGroupings);
|
|
10998
|
+
keys.forEach((key) => {
|
|
10999
|
+
if (Array.isArray(matchUpGroupings[key])) {
|
|
11000
|
+
if (!groupings[key])
|
|
11001
|
+
groupings[key] = [];
|
|
11002
|
+
groupings[key] = groupings[key].concat(matchUpGroupings[key]);
|
|
11003
|
+
}
|
|
11004
|
+
if (key === "groupInfo") {
|
|
11005
|
+
Object.assign(groupInfo, matchUpGroupings[key]);
|
|
11006
|
+
}
|
|
11007
|
+
});
|
|
11008
|
+
return groupings;
|
|
11009
|
+
},
|
|
11010
|
+
{}
|
|
11011
|
+
);
|
|
11012
|
+
return { ...competitionMatchUpsResult, groupInfo };
|
|
10947
11013
|
}
|
|
10948
11014
|
|
|
10949
11015
|
function competitionScheduleMatchUps(params) {
|
|
@@ -11038,7 +11104,7 @@ function competitionScheduleMatchUps(params) {
|
|
|
11038
11104
|
params.matchUpFilters.excludeMatchUpStatuses = [COMPLETED];
|
|
11039
11105
|
}
|
|
11040
11106
|
}
|
|
11041
|
-
const { completedMatchUps, upcomingMatchUps, pendingMatchUps } = competitionMatchUps({
|
|
11107
|
+
const { completedMatchUps, upcomingMatchUps, pendingMatchUps, groupInfo } = competitionMatchUps({
|
|
11042
11108
|
...params,
|
|
11043
11109
|
matchUpFilters: params.matchUpFilters,
|
|
11044
11110
|
contextFilters: params.contextFilters
|
|
@@ -11062,6 +11128,7 @@ function competitionScheduleMatchUps(params) {
|
|
|
11062
11128
|
// completed matchUps for the filter date
|
|
11063
11129
|
dateMatchUps,
|
|
11064
11130
|
// all incomplete matchUps for the filter date
|
|
11131
|
+
groupInfo,
|
|
11065
11132
|
venues
|
|
11066
11133
|
};
|
|
11067
11134
|
if (withCourtGridRows) {
|
|
@@ -11072,7 +11139,7 @@ function competitionScheduleMatchUps(params) {
|
|
|
11072
11139
|
result.courtPrefix = courtPrefix;
|
|
11073
11140
|
result.rows = rows;
|
|
11074
11141
|
}
|
|
11075
|
-
return result;
|
|
11142
|
+
return { ...result, ...SUCCESS };
|
|
11076
11143
|
function getCourtMatchUps({ courtId }) {
|
|
11077
11144
|
const matchUpsToConsider = courtCompletedMatchUps ? dateMatchUps.concat(completedMatchUps ?? []) : dateMatchUps;
|
|
11078
11145
|
const courtMatchUps = matchUpsToConsider.filter(
|
|
@@ -13517,10 +13584,89 @@ function getSeedGroups({
|
|
|
13517
13584
|
}
|
|
13518
13585
|
}
|
|
13519
13586
|
|
|
13587
|
+
function getDivisions({ size }) {
|
|
13588
|
+
const divisions = [size];
|
|
13589
|
+
let division = size;
|
|
13590
|
+
while (division / 2 === Math.floor(division / 2)) {
|
|
13591
|
+
division = division / 2;
|
|
13592
|
+
divisions.push(division);
|
|
13593
|
+
}
|
|
13594
|
+
if (!divisions.includes(1))
|
|
13595
|
+
divisions.push(1);
|
|
13596
|
+
divisions.sort(numericSort);
|
|
13597
|
+
divisions.reverse();
|
|
13598
|
+
return divisions;
|
|
13599
|
+
}
|
|
13600
|
+
function getSubBlock({ blockPattern, index }) {
|
|
13601
|
+
let i = 0;
|
|
13602
|
+
for (const subBlock of blockPattern) {
|
|
13603
|
+
if (i === index)
|
|
13604
|
+
return subBlock;
|
|
13605
|
+
let j = 0;
|
|
13606
|
+
while (j < subBlock.length) {
|
|
13607
|
+
if (i === index)
|
|
13608
|
+
return subBlock;
|
|
13609
|
+
i += 1;
|
|
13610
|
+
j++;
|
|
13611
|
+
}
|
|
13612
|
+
}
|
|
13613
|
+
}
|
|
13614
|
+
function generateBlockPattern({
|
|
13615
|
+
positioning,
|
|
13616
|
+
size
|
|
13617
|
+
}) {
|
|
13618
|
+
const divisions = getDivisions({ size });
|
|
13619
|
+
const divisionGroupings = [];
|
|
13620
|
+
const selected = [];
|
|
13621
|
+
const firstMember = (arr) => arr[0];
|
|
13622
|
+
const lastMember = (arr) => arr[arr.length - 1];
|
|
13623
|
+
const getMember = (arr, i) => (positioning === CLUSTER && i % 2 ? lastMember(arr) : firstMember(arr)) || firstMember(arr);
|
|
13624
|
+
const noneSelected = (chunk, i) => {
|
|
13625
|
+
if (chunk.every((member) => !selected.includes(member))) {
|
|
13626
|
+
const member = getMember(chunk, i);
|
|
13627
|
+
selected.push(member);
|
|
13628
|
+
return member;
|
|
13629
|
+
}
|
|
13630
|
+
};
|
|
13631
|
+
const notSelected = (chunk) => {
|
|
13632
|
+
const notSelected2 = chunk.filter((member) => !selected.includes(member));
|
|
13633
|
+
if (notSelected2.length) {
|
|
13634
|
+
selected.push(...notSelected2);
|
|
13635
|
+
return notSelected2;
|
|
13636
|
+
}
|
|
13637
|
+
};
|
|
13638
|
+
const select = (chunk, i) => {
|
|
13639
|
+
const member = getMember(chunk, i);
|
|
13640
|
+
if (!selected.includes(member)) {
|
|
13641
|
+
selected.push(member);
|
|
13642
|
+
return member;
|
|
13643
|
+
}
|
|
13644
|
+
};
|
|
13645
|
+
const range = generateRange(1, size + 1);
|
|
13646
|
+
for (const division of divisions) {
|
|
13647
|
+
if (division === 1) {
|
|
13648
|
+
const chunks = chunkArray(range, 2);
|
|
13649
|
+
const positions = chunks.map(noneSelected).filter(Boolean);
|
|
13650
|
+
if (positions.length)
|
|
13651
|
+
divisionGroupings.push(positions);
|
|
13652
|
+
const lastPositions = chunks.flatMap(notSelected).filter(Boolean);
|
|
13653
|
+
if (lastPositions.length)
|
|
13654
|
+
divisionGroupings.push(lastPositions);
|
|
13655
|
+
} else {
|
|
13656
|
+
const chunks = chunkArray(range, division);
|
|
13657
|
+
const positions = chunks.map(select).filter(Boolean);
|
|
13658
|
+
if (positions.length)
|
|
13659
|
+
divisionGroupings.push(positions);
|
|
13660
|
+
}
|
|
13661
|
+
}
|
|
13662
|
+
return { divisions, divisionGroupings };
|
|
13663
|
+
}
|
|
13664
|
+
|
|
13520
13665
|
function getValidSeedBlocks({
|
|
13521
13666
|
provisionalPositioning,
|
|
13522
13667
|
returnAllProxies,
|
|
13523
13668
|
appliedPolicies,
|
|
13669
|
+
seedingProfile,
|
|
13524
13670
|
drawDefinition,
|
|
13525
13671
|
allPositions,
|
|
13526
13672
|
structure
|
|
@@ -13554,7 +13700,7 @@ function getValidSeedBlocks({
|
|
|
13554
13700
|
}).filter((f) => f.length).reverse();
|
|
13555
13701
|
const firstRoundDrawPositions = uniqueDrawPositionsByRound.pop();
|
|
13556
13702
|
const firstRoundDrawPositionOffset = firstRoundDrawPositions && Math.min(...firstRoundDrawPositions) - 1 || 0;
|
|
13557
|
-
|
|
13703
|
+
seedingProfile = seedingProfile ?? appliedPolicies?.seeding?.seedingProfile;
|
|
13558
13704
|
const baseDrawSize = firstRoundDrawPositions?.length || 0;
|
|
13559
13705
|
const seedRangeDrawPositionBlocks = uniqueDrawPositionsByRound.filter(
|
|
13560
13706
|
(block) => block.filter((drawPosition) => drawPosition <= seedsCount).length
|
|
@@ -13593,12 +13739,14 @@ function getValidSeedBlocks({
|
|
|
13593
13739
|
);
|
|
13594
13740
|
({ validSeedBlocks } = getSeedBlockPattern({
|
|
13595
13741
|
drawPositionBlocks: drawPositionChunks,
|
|
13742
|
+
nonRandom: seedingProfile?.nonRandom,
|
|
13596
13743
|
positioning,
|
|
13597
13744
|
seedGroups
|
|
13598
13745
|
}));
|
|
13599
13746
|
}
|
|
13600
13747
|
} else if (isContainer) {
|
|
13601
13748
|
const result = getContainerBlocks({
|
|
13749
|
+
nonRandom: seedingProfile?.nonRandom,
|
|
13602
13750
|
seedingProfile,
|
|
13603
13751
|
structure
|
|
13604
13752
|
});
|
|
@@ -13648,7 +13796,7 @@ function getValidSeedBlocks({
|
|
|
13648
13796
|
isFeedIn
|
|
13649
13797
|
};
|
|
13650
13798
|
}
|
|
13651
|
-
function getContainerBlocks({ seedingProfile, structure }) {
|
|
13799
|
+
function getContainerBlocks({ seedingProfile, structure, nonRandom }) {
|
|
13652
13800
|
const containedStructures = structure.structures || [];
|
|
13653
13801
|
const roundRobinGroupsCount = containedStructures.length;
|
|
13654
13802
|
const positionAssignments = getPositionAssignments({
|
|
@@ -13668,26 +13816,48 @@ function getContainerBlocks({ seedingProfile, structure }) {
|
|
|
13668
13816
|
return getSeedBlockPattern({
|
|
13669
13817
|
drawPositionBlocks,
|
|
13670
13818
|
positioning,
|
|
13671
|
-
seedGroups
|
|
13819
|
+
seedGroups,
|
|
13820
|
+
nonRandom
|
|
13672
13821
|
});
|
|
13673
13822
|
}
|
|
13674
|
-
function getSeedBlockPattern({
|
|
13823
|
+
function getSeedBlockPattern({
|
|
13824
|
+
drawPositionBlocks,
|
|
13825
|
+
positioning,
|
|
13826
|
+
seedGroups,
|
|
13827
|
+
nonRandom
|
|
13828
|
+
}) {
|
|
13675
13829
|
const validSeedBlocks = [];
|
|
13676
|
-
const
|
|
13677
|
-
|
|
13830
|
+
const { divisionGroupings } = generateBlockPattern({
|
|
13831
|
+
size: seedGroups.length,
|
|
13832
|
+
positioning
|
|
13833
|
+
});
|
|
13678
13834
|
const assignedPositions = [];
|
|
13679
13835
|
seedGroups.forEach((seedGroup, i) => {
|
|
13680
|
-
|
|
13681
|
-
|
|
13682
|
-
|
|
13836
|
+
const relativePositions = getSubBlock({
|
|
13837
|
+
blockPattern: divisionGroupings,
|
|
13838
|
+
index: i
|
|
13839
|
+
});
|
|
13683
13840
|
seedGroup.forEach((seedNumber, j) => {
|
|
13684
13841
|
const blockIndex = i % 2 ? drawPositionBlocks.length - j - 1 : j;
|
|
13685
|
-
const
|
|
13686
|
-
|
|
13687
|
-
|
|
13688
|
-
|
|
13689
|
-
|
|
13690
|
-
|
|
13842
|
+
const block = drawPositionBlocks[blockIndex].slice();
|
|
13843
|
+
let consideredDrawPositions = block.filter(
|
|
13844
|
+
(drawPosition2, i2) => relativePositions.includes(i2 + 1) && drawPosition2
|
|
13845
|
+
);
|
|
13846
|
+
if (positioning !== WATERFALL) {
|
|
13847
|
+
consideredDrawPositions = nonRandom ? consideredDrawPositions : shuffleArray(consideredDrawPositions);
|
|
13848
|
+
} else if (i % 2) {
|
|
13849
|
+
consideredDrawPositions.reverse();
|
|
13850
|
+
}
|
|
13851
|
+
const drawPosition = consideredDrawPositions.find(
|
|
13852
|
+
(drawPosition2) => !assignedPositions.includes(drawPosition2)
|
|
13853
|
+
);
|
|
13854
|
+
if (drawPosition) {
|
|
13855
|
+
assignedPositions.push(drawPosition);
|
|
13856
|
+
validSeedBlocks.push({
|
|
13857
|
+
seedNumbers: [seedNumber],
|
|
13858
|
+
drawPositions: [drawPosition]
|
|
13859
|
+
});
|
|
13860
|
+
}
|
|
13691
13861
|
});
|
|
13692
13862
|
});
|
|
13693
13863
|
return { validSeedBlocks };
|
|
@@ -13764,6 +13934,7 @@ function getNextSeedBlock(params) {
|
|
|
13764
13934
|
const {
|
|
13765
13935
|
provisionalPositioning,
|
|
13766
13936
|
drawDefinition,
|
|
13937
|
+
seedingProfile,
|
|
13767
13938
|
seedBlockInfo,
|
|
13768
13939
|
structureId,
|
|
13769
13940
|
randomize
|
|
@@ -13786,6 +13957,7 @@ function getNextSeedBlock(params) {
|
|
|
13786
13957
|
provisionalPositioning,
|
|
13787
13958
|
appliedPolicies,
|
|
13788
13959
|
drawDefinition,
|
|
13960
|
+
seedingProfile,
|
|
13789
13961
|
structure
|
|
13790
13962
|
})?.validSeedBlocks;
|
|
13791
13963
|
const unfilledSeedBlocks = (validSeedBlocks || []).filter((seedBlock) => {
|
|
@@ -13879,6 +14051,7 @@ function getValidAssignmentActions({
|
|
|
13879
14051
|
returnParticipants,
|
|
13880
14052
|
appliedPolicies,
|
|
13881
14053
|
drawDefinition,
|
|
14054
|
+
seedingProfile,
|
|
13882
14055
|
isByePosition,
|
|
13883
14056
|
drawPosition,
|
|
13884
14057
|
structureId,
|
|
@@ -13894,6 +14067,7 @@ function getValidAssignmentActions({
|
|
|
13894
14067
|
returnAllProxies: true,
|
|
13895
14068
|
randomize: true,
|
|
13896
14069
|
drawDefinition,
|
|
14070
|
+
seedingProfile,
|
|
13897
14071
|
structureId,
|
|
13898
14072
|
event
|
|
13899
14073
|
});
|