tods-competition-factory 2.2.0 → 2.2.2

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.
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  function factoryVersion() {
6
- return '2.2.0';
6
+ return '2.2.2';
7
7
  }
8
8
 
9
9
  const SINGLES_MATCHUP = 'SINGLES';
@@ -10786,17 +10786,28 @@ function getAllStructureMatchUps(params) {
10786
10786
  structureId,
10787
10787
  }).drawPositionsRanges
10788
10788
  : undefined;
10789
+ let tournamentParticipants = params.tournamentParticipants;
10790
+ let participantMap = params.participantMap;
10791
+ if (!tournamentParticipants?.length && !participantMap && tournamentRecord) {
10792
+ ({ participants: tournamentParticipants = [], participantMap } = hydrateParticipants({
10793
+ participantsProfile: params.participantsProfile,
10794
+ useParticipantMap: params.useParticipantMap,
10795
+ policyDefinitions: params.policyDefinitions,
10796
+ tournamentRecord,
10797
+ contextProfile,
10798
+ inContext,
10799
+ }));
10800
+ }
10789
10801
  matchUps = matchUps.map((matchUp) => {
10790
10802
  return addMatchUpContext({
10791
- tournamentParticipants: params.tournamentParticipants ?? tournamentRecord?.participants,
10792
10803
  scheduleVisibilityFilters: params.scheduleVisibilityFilters,
10793
10804
  hydrateParticipants: params.hydrateParticipants,
10794
10805
  afterRecoveryTimes: params.afterRecoveryTimes,
10795
10806
  usePublishState: params.usePublishState,
10796
- participantMap: params.participantMap,
10797
10807
  scheduleTiming: params.scheduleTiming,
10798
10808
  publishStatus: params.publishStatus,
10799
10809
  sourceDrawPositionRanges,
10810
+ tournamentParticipants,
10800
10811
  positionAssignments,
10801
10812
  drawPositionsRanges,
10802
10813
  initialRoundOfPlay,
@@ -10805,6 +10816,7 @@ function getAllStructureMatchUps(params) {
10805
10816
  appliedPolicies,
10806
10817
  seedAssignments,
10807
10818
  contextContent,
10819
+ participantMap,
10808
10820
  contextProfile,
10809
10821
  drawDefinition,
10810
10822
  scoringActive,
@@ -34813,7 +34825,7 @@ const displayConstants = {
34813
34825
  };
34814
34826
 
34815
34827
  function getDrawData(params) {
34816
- const { tournamentParticipants = [], includePositionAssignments, policyDefinitions, tournamentRecord, inContext = true, usePublishState, status = PUBLIC, pressureRating, refreshResults, drawDefinition, noDeepCopy, sortConfig, context, event, } = params;
34828
+ const { tournamentParticipants = [], includePositionAssignments, policyDefinitions, tournamentRecord, inContext = true, usePublishState, status = PUBLIC, pressureRating, refreshResults, contextProfile, drawDefinition, noDeepCopy, sortConfig, context, event, } = params;
34817
34829
  if (!drawDefinition)
34818
34830
  return { error: MISSING_DRAW_DEFINITION };
34819
34831
  const drawInfo = (({ matchUpFormat, updatedAt, drawType, drawName, drawId }) => ({
@@ -34868,11 +34880,13 @@ function getDrawData(params) {
34868
34880
  seedAssignments: !structure?.seedAssignments?.length ? seedAssignments : undefined,
34869
34881
  context: { drawId: drawInfo.drawId, ...context },
34870
34882
  hydrateParticipants: params.hydrateParticipants,
34883
+ participantsProfile: params.participantsProfile,
34871
34884
  tournamentParticipants,
34872
34885
  policyDefinitions,
34873
34886
  tournamentRecord,
34874
34887
  usePublishState,
34875
34888
  publishStatus,
34889
+ contextProfile,
34876
34890
  drawDefinition,
34877
34891
  inContext,
34878
34892
  structure,
@@ -34984,7 +34998,7 @@ function getDrawData(params) {
34984
34998
  }
34985
34999
 
34986
35000
  function getEventData(params) {
34987
- const { includePositionAssignments, participantsProfile, policyDefinitions, usePublishState, status = PUBLIC, sortConfig, } = params;
35001
+ const { includePositionAssignments, participantsProfile, policyDefinitions, usePublishState, status = PUBLIC, contextProfile, sortConfig, } = params;
34988
35002
  const paramsCheck = checkRequiredParameters(params, [
34989
35003
  { tournamentRecord: true },
34990
35004
  { [ANY_OF]: { event: false, eventId: false } },
@@ -35066,6 +35080,7 @@ function getEventData(params) {
35066
35080
  policyDefinitions,
35067
35081
  tournamentRecord,
35068
35082
  usePublishState,
35083
+ contextProfile,
35069
35084
  drawDefinition,
35070
35085
  publishStatus,
35071
35086
  sortConfig,
@@ -36550,7 +36565,12 @@ function tournamentMatchUps(params) {
36550
36565
  if (!matchUps[key])
36551
36566
  matchUps[key] = [];
36552
36567
  matchUps[key] = matchUps[key].concat(eventMatchUps[key]);
36553
- matchUps.matchUpsCount += eventMatchUps[key].length;
36568
+ if (matchUps.matchUpsCount !== undefined) {
36569
+ matchUps.matchUpsCount += eventMatchUps[key].length;
36570
+ }
36571
+ else {
36572
+ matchUps.matchUpsCount = eventMatchUps[key].length;
36573
+ }
36554
36574
  }
36555
36575
  });
36556
36576
  return matchUps;
@@ -41523,7 +41543,7 @@ function getScheduleTimes(params) {
41523
41543
  date,
41524
41544
  });
41525
41545
  if (calculateStartTimeFromCourts && firstTimeSlotStartTime) {
41526
- startTime = firstTimeSlotStartTime ? firstTimeSlotStartTime : startTime;
41546
+ startTime = firstTimeSlotStartTime ?? startTime;
41527
41547
  }
41528
41548
  const dayStartMinutes = timeStringMinutes$1(startTime);
41529
41549
  const dayEndMinutes = timeStringMinutes$1(endTime);
@@ -44130,7 +44150,7 @@ function setMatchUpHomeParticipantId(params) {
44130
44150
  const participantIds = resolutions?.matchUp?.matchUp?.sides?.map((side) => side?.participantId);
44131
44151
  if (params.homeParticipantId && !participantIds?.includes(params.homeParticipantId))
44132
44152
  return { error: INVALID_PARTICIPANT_ID };
44133
- const { disableNotice = true, homeParticipantId, removePriorValues, tournamentRecord, drawDefinition, matchUpId, } = params;
44153
+ const { disableNotice, homeParticipantId, removePriorValues, tournamentRecord, drawDefinition, matchUpId } = params;
44134
44154
  const timeItem = {
44135
44155
  itemType: HOME_PARTICIPANT_ID,
44136
44156
  itemValue: homeParticipantId,