tods-competition-factory 2.1.19 → 2.1.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.
@@ -7567,14 +7567,14 @@ type GetMatchUpsToScheduleArgs = {
7567
7567
  matchUpPotentialParticipantIds?: {
7568
7568
  [key: string]: string[];
7569
7569
  };
7570
- matchUpScheduleTimes: {
7570
+ matchUpScheduleTimes?: {
7571
7571
  [key: string]: string;
7572
7572
  };
7573
7573
  matchUpNotBeforeTimes?: {
7574
7574
  [key: string]: any;
7575
7575
  };
7576
7576
  scheduleCompletedMatchUps?: boolean;
7577
- dateScheduledMatchUpIds: string[];
7577
+ dateScheduledMatchUpIds?: string[];
7578
7578
  orderedMatchUpIds?: string[];
7579
7579
  clearDate?: boolean;
7580
7580
  matchUps: any[];
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  function factoryVersion() {
6
- return '2.1.19';
6
+ return '2.1.21';
7
7
  }
8
8
 
9
9
  const SINGLES_MATCHUP = 'SINGLES';
@@ -14383,10 +14383,17 @@ function getParticipants(params) {
14383
14383
  const template = isObject(withIndividualParticipants) ? withIndividualParticipants : undefined;
14384
14384
  for (const participant of filteredParticipants) {
14385
14385
  for (const individualParticipantId of participant.individualParticipantIds ?? []) {
14386
- if (!participant.individualParticipants)
14386
+ const mappedParticipant = participantMap[participant.participantId].participant;
14387
+ if (!mappedParticipant?.individualParticipants)
14388
+ mappedParticipant.individualParticipants = [];
14389
+ if (!participant.individualParticipants) {
14387
14390
  participant.individualParticipants = [];
14391
+ }
14388
14392
  const source = ppMap.get(individualParticipantId);
14389
- participant.individualParticipants.push(template ? attributeFilter({ template, source }) : source);
14393
+ const individualParticipant = template ? attributeFilter({ template, source }) : source;
14394
+ if (mappedParticipant?.individualParticipants)
14395
+ mappedParticipant.individualParticipants.push(individualParticipant);
14396
+ participant.individualParticipants.push(individualParticipant);
14390
14397
  }
14391
14398
  }
14392
14399
  }
@@ -22781,7 +22788,7 @@ function modifyMatchUpScore(params) {
22781
22788
  let matchUpFormat = params.matchUpFormat;
22782
22789
  let matchUp = params.matchUp;
22783
22790
  let structure;
22784
- const { matchUpStatusCodes, removeWinningSide, tournamentRecord, drawDefinition, matchUpStatus, removeScore, winningSide, matchUpId, event, notes, score, } = params;
22791
+ const { matchUpStatusCodes, tournamentRecord, drawDefinition, matchUpStatus, removeScore, winningSide, matchUpId, event, notes, score, } = params;
22785
22792
  const hasPolicies = params.appliedPolicies && Object.keys(params.appliedPolicies).length;
22786
22793
  const appliedPolicies = hasPolicies
22787
22794
  ? params.appliedPolicies
@@ -22823,7 +22830,7 @@ function modifyMatchUpScore(params) {
22823
22830
  matchUp.matchUpStatusCodes = matchUpStatusCodes;
22824
22831
  if (winningSide)
22825
22832
  matchUp.winningSide = winningSide;
22826
- if (removeWinningSide)
22833
+ if (params.removeWinningSide)
22827
22834
  matchUp.winningSide = undefined;
22828
22835
  if (!structure && drawDefinition) {
22829
22836
  ({ structure } = findDrawMatchUp({
@@ -22930,9 +22937,10 @@ function modifyMatchUpScore(params) {
22930
22937
  }
22931
22938
 
22932
22939
  function attemptToModifyScore(params) {
22933
- const { matchUpStatusCodes, matchUpStatus, structure, matchUp, dualMatchUp, inContextMatchUp } = params;
22940
+ const { matchUpStatusCodes, matchUpStatus, structure, matchUp, dualMatchUp, inContextMatchUp, autoCalcDisabled } = params;
22934
22941
  const matchUpStatusIsValid = isDirectingMatchUpStatus({ matchUpStatus }) ||
22935
- ([CANCELLED$1, ABANDONED$1].includes(matchUpStatus) && dualMatchUp);
22942
+ ([CANCELLED$1, ABANDONED$1].includes(matchUpStatus) && dualMatchUp) ||
22943
+ autoCalcDisabled;
22936
22944
  const participantsCount = matchUp?.sides?.map((side) => side.participantId).filter(Boolean).length ||
22937
22945
  inContextMatchUp?.sides?.map((side) => side.participantId).filter(Boolean).length;
22938
22946
  const stack = 'attemptToModifyScore';
@@ -35132,8 +35140,8 @@ function getMatchUpsToSchedule(params) {
35132
35140
  const paramsCheck = checkRequiredParameters(params, [{ [MATCHUPS]: true }]);
35133
35141
  if (paramsCheck.error)
35134
35142
  return paramsCheck;
35135
- const { matchUpPotentialParticipantIds, scheduleCompletedMatchUps, dateScheduledMatchUpIds, matchUpNotBeforeTimes, matchUpScheduleTimes, orderedMatchUpIds, clearDate, matchUps, } = params;
35136
- const alreadyScheduledMatchUpIds = Object.keys(matchUpScheduleTimes);
35143
+ const { matchUpPotentialParticipantIds, dateScheduledMatchUpIds = [], scheduleCompletedMatchUps, matchUpNotBeforeTimes, matchUpScheduleTimes, orderedMatchUpIds, clearDate, matchUps, } = params;
35144
+ const alreadyScheduledMatchUpIds = matchUpScheduleTimes ? Object.keys(matchUpScheduleTimes) : [];
35137
35145
  const matchUpsToSchedule = (orderedMatchUpIds ?? [])
35138
35146
  .map((matchUpId) => matchUps.find((matchUp) => matchUp.matchUpId === matchUpId))
35139
35147
  .filter(Boolean)
@@ -44009,7 +44017,7 @@ function noDownstreamDependencies(params) {
44009
44017
  let connectedStructures;
44010
44018
  const { structure, drawDefinition, dualMatchUp, disableAutoCalc } = params;
44011
44019
  if (dualMatchUp?._disableAutoCalc && disableAutoCalc !== false) {
44012
- return attemptToModifyScore(params);
44020
+ return attemptToModifyScore({ ...params, removeWinningSide });
44013
44021
  }
44014
44022
  const { connectedStructureIds } = checkConnectedStructures({
44015
44023
  drawDefinition,
@@ -46721,7 +46729,7 @@ function getVenueSchedulingDetails({ matchUpPotentialParticipantIds, individualP
46721
46729
  let dateScheduledMatchUps;
46722
46730
  let scheduleTimes = [];
46723
46731
  if (useGarman) {
46724
- ({ scheduleTimes, dateScheduledMatchUpIds, dateScheduledMatchUps } = generateScheduleTimes({
46732
+ ({ scheduleTimes, dateScheduledMatchUpIds } = generateScheduleTimes({
46725
46733
  averageMatchUpMinutes: groupedRounds[0]?.averageMinutes,
46726
46734
  scheduleDate: extractDate(scheduleDate),
46727
46735
  venueIds: [venue.venueId],