tods-competition-factory 2.2.29 → 2.2.31

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.29';
6
+ return '2.2.31';
7
7
  }
8
8
 
9
9
  const SINGLES_MATCHUP = 'SINGLES';
@@ -1870,7 +1870,9 @@ function decorateResult({ context, result, stack, info }) {
1870
1870
  result.info = info;
1871
1871
  }
1872
1872
  if (result && typeof context === 'object' && Object.keys(context).length) {
1873
- Object.assign(result, definedAttributes(context));
1873
+ if (!result.context)
1874
+ result.context = {};
1875
+ Object.assign(result.context, definedAttributes(context));
1874
1876
  }
1875
1877
  if (result && !result?.error && !result?.success) {
1876
1878
  Object.assign(result, { ...SUCCESS });
@@ -12235,62 +12237,6 @@ function getInitialRoundNumber({ drawPosition, matchUps = [] }) {
12235
12237
  return { initialRoundNumber };
12236
12238
  }
12237
12239
 
12238
- const logColors = {
12239
- reset: '\x1b[0m',
12240
- bright: '\x1b[1m',
12241
- dim: '\x1b[2m',
12242
- red: '\x1b[31m',
12243
- brightred: '\x1b[91m',
12244
- green: '\x1b[32m',
12245
- brightgreen: '\x1b[92m',
12246
- yellow: '\x1b[33m',
12247
- brightyellow: '\x1b[93m',
12248
- blue: '\x1b[34m',
12249
- brightblue: '\x1b[94m',
12250
- lightblue: '\x1b[105m',
12251
- magenta: '\x1b[35m',
12252
- brightmagenta: '\x1b[95m',
12253
- cyan: '\x1b[36m',
12254
- brightcyan: '\x1b[96m',
12255
- white: '\x1b[37m',
12256
- brightwhite: '\x1b[97m',
12257
- };
12258
-
12259
- const globalLog = [];
12260
- function pushGlobalLog(value, devContextOverride) {
12261
- if (isString(value))
12262
- value = { method: value };
12263
- if (devContextOverride || getDevContext())
12264
- globalLog.push(value);
12265
- }
12266
- function getGlobalLog(purge) {
12267
- const globalLogCopy = globalLog.slice();
12268
- return globalLogCopy;
12269
- }
12270
- function printGlobalLog(purge) {
12271
- const globalLogCopy = getGlobalLog();
12272
- const modifiedText = globalLogCopy.map((line) => {
12273
- const { color, keyColors, method, newline } = line;
12274
- const methodColor = Object.keys(logColors).includes(color) ? logColors[color] : logColors.cyan;
12275
- const bodyKeys = Object.keys(line).filter((key) => !['color', 'keyColors', 'method', 'newline'].includes(key));
12276
- const body = bodyKeys
12277
- .map((key) => {
12278
- const keyColor = keyColors && Object.keys(keyColors).includes(key) && logColors[keyColors[key]]
12279
- ? logColors[keyColors[key]]
12280
- : logColors.brightwhite;
12281
- return `${logColors.white}${key}: ${keyColor}${line[key]}`;
12282
- })
12283
- .join(', ');
12284
- const tabs = method?.length < 15 ? `\t\t` : '\t';
12285
- return [newline ? '\n' : '', methodColor, method, tabs, logColors.white, body, logColors.reset, '\n'].join('');
12286
- });
12287
- if (modifiedText?.length)
12288
- console.log(...modifiedText);
12289
- }
12290
- function purgeGlobalLog() {
12291
- globalLog.length = 0;
12292
- }
12293
-
12294
12240
  function assignDrawPositionBye({ provisionalPositioning, isPositionAction, tournamentRecord, drawDefinition, drawPosition, matchUpsMap, structureId, structure, event, }) {
12295
12241
  if (!drawDefinition)
12296
12242
  return { error: MISSING_DRAW_DEFINITION };
@@ -12301,7 +12247,6 @@ function assignDrawPositionBye({ provisionalPositioning, isPositionAction, tourn
12301
12247
  if (!structureId)
12302
12248
  ({ structureId } = structure);
12303
12249
  const stack = 'assignDrawPositionBye';
12304
- pushGlobalLog({ method: stack, color: 'cyan', drawPosition });
12305
12250
  if (!matchUpsMap) {
12306
12251
  matchUpsMap = getMatchUpsMap({ drawDefinition });
12307
12252
  }
@@ -12461,8 +12406,6 @@ function assignRoundRobinBYE({ tournamentRecord, drawDefinition, drawPosition, m
12461
12406
  });
12462
12407
  }
12463
12408
  function advanceDrawPosition({ drawPositionToAdvance, inContextDrawMatchUps, sourceDrawPositions, tournamentRecord, drawDefinition, matchUpsMap, matchUpId, event, }) {
12464
- const stack = 'advanceDrawPosition';
12465
- pushGlobalLog({ method: stack, color: 'cyan', drawPositionToAdvance });
12466
12409
  const matchUp = matchUpsMap.drawMatchUps.find((matchUp) => matchUp.matchUpId === matchUpId);
12467
12410
  const inContextMatchUp = inContextDrawMatchUps.find((matchUp) => matchUp.matchUpId === matchUpId);
12468
12411
  const structureId = inContextMatchUp?.structureId;
@@ -12575,14 +12518,6 @@ function advanceWinner({ drawPositionToAdvance, inContextDrawMatchUps, sourceDra
12575
12518
  winningSide: undefined,
12576
12519
  drawPositions,
12577
12520
  });
12578
- const changedDrawPosition = noContextWinnerMatchUp.drawPositions.find((position) => !twoDrawPositions.includes(position));
12579
- pushGlobalLog({
12580
- method: stack,
12581
- color: 'brightyellow',
12582
- changedDrawPosition,
12583
- pairedDrawPositionIsBye,
12584
- drawPositionIsBye,
12585
- });
12586
12521
  modifyMatchUpNotice({
12587
12522
  tournamentId: tournamentRecord?.tournamentId,
12588
12523
  matchUp: noContextWinnerMatchUp,
@@ -12637,8 +12572,6 @@ function advanceWinner({ drawPositionToAdvance, inContextDrawMatchUps, sourceDra
12637
12572
  }
12638
12573
  function assignFedDrawPositionBye({ loserTargetDrawPosition, tournamentRecord, loserTargetLink, drawDefinition, loserMatchUp, matchUpsMap, event, }) {
12639
12574
  const { roundNumber } = loserMatchUp;
12640
- const stack = 'assignFedDrawPositionBye';
12641
- pushGlobalLog({ method: stack, color: 'cyan', loserTargetDrawPosition });
12642
12575
  const mappedMatchUps = matchUpsMap?.mappedMatchUps || {};
12643
12576
  const loserStructureMatchUps = mappedMatchUps[loserMatchUp.structureId].matchUps;
12644
12577
  const { initialRoundNumber } = getInitialRoundNumber({
@@ -12682,6 +12615,65 @@ function modifyRoundRobinMatchUpsStatus({ positionAssignments, tournamentRecord,
12682
12615
  });
12683
12616
  }
12684
12617
 
12618
+ const logColors = {
12619
+ reset: '\x1b[0m',
12620
+ bright: '\x1b[1m',
12621
+ dim: '\x1b[2m',
12622
+ red: '\x1b[31m',
12623
+ brightred: '\x1b[91m',
12624
+ green: '\x1b[32m',
12625
+ brightgreen: '\x1b[92m',
12626
+ yellow: '\x1b[33m',
12627
+ brightyellow: '\x1b[93m',
12628
+ blue: '\x1b[34m',
12629
+ brightblue: '\x1b[94m',
12630
+ pinkbackground: '\x1b[105m',
12631
+ magenta: '\x1b[35m',
12632
+ brightmagenta: '\x1b[95m',
12633
+ cyan: '\x1b[36m',
12634
+ brightcyan: '\x1b[96m',
12635
+ white: '\x1b[37m',
12636
+ brightwhite: '\x1b[97m',
12637
+ };
12638
+
12639
+ const globalLog = [];
12640
+ function pushGlobalLog(value, devContextOverride) {
12641
+ if (isString(value))
12642
+ value = { method: value };
12643
+ if (devContextOverride || getDevContext())
12644
+ globalLog.push(value);
12645
+ }
12646
+ function getGlobalLog(purge) {
12647
+ const globalLogCopy = globalLog.slice();
12648
+ return globalLogCopy;
12649
+ }
12650
+ function printGlobalLog(purge) {
12651
+ const globalLogCopy = getGlobalLog();
12652
+ const modifiedText = globalLogCopy.map((line) => {
12653
+ const { color, keyColors, method, newline } = line;
12654
+ const methodColor = Object.keys(logColors).includes(color) ? logColors[color] : logColors.cyan;
12655
+ const bodyKeys = Object.keys(line).filter((key) => !['color', 'keyColors', 'method', 'newline'].includes(key));
12656
+ const body = bodyKeys
12657
+ .map((key) => {
12658
+ const keyColor = (line[key] === undefined && logColors.red) ||
12659
+ (keyColors &&
12660
+ Object.keys(keyColors).includes(key) &&
12661
+ logColors[keyColors[key]] &&
12662
+ logColors[keyColors[key]]) ||
12663
+ logColors.brightwhite;
12664
+ return `${logColors.white}${key}: ${keyColor}${line[key]}`;
12665
+ })
12666
+ .join(', ');
12667
+ const tabs = (method?.length <= 12 && '\t\t\t') || (method?.length <= 20 && `\t\t`) || '\t';
12668
+ return [newline ? '\n' : '', methodColor, method, tabs, logColors.white, body, logColors.reset, '\n'].join('');
12669
+ });
12670
+ if (modifiedText?.length)
12671
+ console.log(...modifiedText);
12672
+ }
12673
+ function purgeGlobalLog() {
12674
+ globalLog.length = 0;
12675
+ }
12676
+
12685
12677
  function clearDrawPosition(params) {
12686
12678
  let { inContextDrawMatchUps, participantId, drawPosition } = params;
12687
12679
  const { tournamentRecord, drawDefinition, structureId, matchUpsMap, event } = params;
@@ -14673,13 +14665,14 @@ function addDrawEntry(params) {
14673
14665
  function addDrawEntries$1(params) {
14674
14666
  const stack = 'addDrawEntries';
14675
14667
  const { suppressDuplicateEntries = true, entryStatus = DIRECT_ACCEPTANCE, autoEntryPositions = true, ignoreStageSpace, participantIds, drawDefinition, stageSequence, stage = MAIN, roundTarget, extension, event, } = params;
14668
+ const isAdHocDraw = drawDefinition.drawType === AD_HOC;
14676
14669
  if (!stage)
14677
14670
  return { error: MISSING_STAGE };
14678
14671
  if (!drawDefinition)
14679
14672
  return { error: MISSING_DRAW_DEFINITION };
14680
14673
  if (!Array.isArray(participantIds))
14681
14674
  return { error: INVALID_PARTICIPANT_IDS };
14682
- if (!getValidStage({ stage, drawDefinition })) {
14675
+ if (!isAdHocDraw && !getValidStage({ stage, drawDefinition })) {
14683
14676
  return { error: INVALID_STAGE };
14684
14677
  }
14685
14678
  if (extension && !isValidExtension({ extension })) {
@@ -14696,11 +14689,14 @@ function addDrawEntries$1(params) {
14696
14689
  entryStatus,
14697
14690
  stage,
14698
14691
  });
14699
- if (!ignoreStageSpace && !spaceAvailable.success) {
14692
+ if (!ignoreStageSpace && !spaceAvailable.success && !isAdHocDraw) {
14700
14693
  return { error: spaceAvailable.error };
14701
14694
  }
14702
14695
  const positionsAvailable = spaceAvailable.positionsAvailable ?? 0;
14703
- if (!ignoreStageSpace && stage !== VOLUNTARY_CONSOLATION && positionsAvailable < participantIds.length)
14696
+ if (!ignoreStageSpace &&
14697
+ !isAdHocDraw &&
14698
+ stage !== VOLUNTARY_CONSOLATION &&
14699
+ positionsAvailable < participantIds.length)
14704
14700
  return { error: PARTICIPANT_COUNT_EXCEEDS_DRAW_SIZE };
14705
14701
  const duplicateEntries = [];
14706
14702
  const drawId = drawDefinition.drawId;
@@ -16642,6 +16638,7 @@ function assignMatchUpDrawPosition({ inContextDrawMatchUps, sourceMatchUpStatus,
16642
16638
  [DOUBLE_WALKOVER, DOUBLE_DEFAULT].includes(matchUp.matchUpStatus) &&
16643
16639
  matchUp.matchUpStatus) ||
16644
16640
  TO_BE_PLAYED;
16641
+ const isWalkover = !!([WALKOVER$2, DEFAULTED].includes(matchUp?.matchUpStatus) && matchUp?.winningSide);
16645
16642
  if (matchUp && positionAdded) {
16646
16643
  inContextDrawMatchUps =
16647
16644
  getAllDrawMatchUps({
@@ -16654,8 +16651,9 @@ function assignMatchUpDrawPosition({ inContextDrawMatchUps, sourceMatchUpStatus,
16654
16651
  inContextDrawMatchUps,
16655
16652
  drawPosition,
16656
16653
  matchUpId,
16657
- })) ||
16658
- undefined;
16654
+ }))
16655
+ || (isWalkover && matchUp.winningSide)
16656
+ || undefined;
16659
16657
  if (matchUp?.matchUpStatusCodes) {
16660
16658
  updateMatchUpStatusCodes({
16661
16659
  inContextDrawMatchUps,
@@ -16668,7 +16666,7 @@ function assignMatchUpDrawPosition({ inContextDrawMatchUps, sourceMatchUpStatus,
16668
16666
  Object.assign(matchUp, {
16669
16667
  drawPositions: updatedDrawPositions,
16670
16668
  winningSide: exitWinningSide,
16671
- matchUpStatus,
16669
+ matchUpStatus: isWalkover ? matchUp?.matchUpStatus : matchUpStatus,
16672
16670
  });
16673
16671
  modifyMatchUpNotice({
16674
16672
  tournamentId: tournamentRecord?.tournamentId,
@@ -16711,6 +16709,20 @@ function assignMatchUpDrawPosition({ inContextDrawMatchUps, sourceMatchUpStatus,
16711
16709
  }
16712
16710
  }
16713
16711
  }
16712
+ else if (positionAssigned && isWalkover) {
16713
+ if (winnerMatchUp) {
16714
+ const result = assignMatchUpDrawPosition({
16715
+ matchUpId: winnerMatchUp.matchUpId,
16716
+ inContextDrawMatchUps,
16717
+ tournamentRecord,
16718
+ drawDefinition,
16719
+ drawPosition,
16720
+ matchUpsMap,
16721
+ });
16722
+ if (result.error)
16723
+ return result;
16724
+ }
16725
+ }
16714
16726
  else if (winnerMatchUp && inContextMatchUp && !inContextMatchUp.feedRound) {
16715
16727
  const { pairedPreviousMatchUpIsDoubleExit } = getPairedPreviousMatchUpIsDoubleExit({
16716
16728
  targetMatchUp: matchUp,
@@ -23188,7 +23200,7 @@ function modifyMatchUpScore(params) {
23188
23200
  }
23189
23201
 
23190
23202
  function attemptToModifyScore(params) {
23191
- const { matchUpStatusCodes, matchUpStatus, structure, matchUp, dualMatchUp, inContextMatchUp, autoCalcDisabled } = params;
23203
+ const { matchUpStatusCodes, matchUpStatus, structure, matchUp, dualMatchUp, inContextMatchUp, autoCalcDisabled, propagateExitStatus, } = params;
23192
23204
  const matchUpStatusIsValid = isDirectingMatchUpStatus({ matchUpStatus }) ||
23193
23205
  ([CANCELLED$1, ABANDONED$1].includes(matchUpStatus) && dualMatchUp) ||
23194
23206
  autoCalcDisabled;
@@ -23198,13 +23210,15 @@ function attemptToModifyScore(params) {
23198
23210
  const hasAdHocSides = (isAdHoc({ structure }) && participantsCount === 1) || (matchUpStatus === DEFAULTED && participantsCount);
23199
23211
  const validToScore = hasAdHocSides ||
23200
23212
  drawPositionsAssignedParticipantIds({ structure, matchUp, inContextMatchUp }) ||
23201
- params.appliedPolicies?.[POLICY_TYPE_SCORING]?.requireParticipantsForScoring === false;
23213
+ params.appliedPolicies?.[POLICY_TYPE_SCORING]?.requireParticipantsForScoring === false ||
23214
+ ([WALKOVER$2, DEFAULTED].includes(matchUpStatus) && participantsCount === 1 && propagateExitStatus);
23202
23215
  if (!validToScore)
23203
23216
  return decorateResult({ result: { error: MISSING_ASSIGNMENTS }, stack });
23204
23217
  const removeScore = [WALKOVER$2].includes(matchUpStatus);
23205
23218
  const updatedMatchUpStatus = matchUpStatusIsValid ? matchUpStatus : (params.winningSide && COMPLETED$1) || INCOMPLETE;
23206
23219
  const result = modifyMatchUpScore({
23207
23220
  ...params,
23221
+ winningSide: params.winningSide,
23208
23222
  matchUpStatusCodes: (matchUpStatusIsValid && matchUpStatusCodes) || [],
23209
23223
  matchUpStatus: updatedMatchUpStatus,
23210
23224
  removeScore,
@@ -23720,7 +23734,7 @@ function directWinner({ winnerMatchUpDrawPositionIndex, inContextDrawMatchUps, p
23720
23734
  if (structure?.stage !== QUALIFYING) {
23721
23735
  const error = 'winner target position unavaiallble';
23722
23736
  console.log(error);
23723
- return { error };
23737
+ decorateResult({ stack, result: { error } });
23724
23738
  }
23725
23739
  }
23726
23740
  if (structure?.seedAssignments && structure.structureId !== targetStructureId) {
@@ -23784,7 +23798,7 @@ function directWinner({ winnerMatchUpDrawPositionIndex, inContextDrawMatchUps, p
23784
23798
  }
23785
23799
 
23786
23800
  function directLoser(params) {
23787
- const { loserMatchUpDrawPositionIndex, inContextDrawMatchUps, projectedWinningSide, sourceMatchUpStatus, loserDrawPosition, tournamentRecord, loserTargetLink, drawDefinition, loserMatchUp, dualMatchUp, matchUpsMap, event, } = params;
23801
+ const { loserMatchUpDrawPositionIndex, inContextDrawMatchUps, projectedWinningSide, propagateExitStatus, sourceMatchUpStatus, loserDrawPosition, tournamentRecord, loserTargetLink, drawDefinition, loserMatchUp, dualMatchUp, matchUpsMap, event, } = params;
23788
23802
  const stack = 'directLoser';
23789
23803
  const loserLinkCondition = loserTargetLink.linkCondition;
23790
23804
  const targetMatchUpDrawPositions = loserMatchUp.drawPositions || [];
@@ -23818,15 +23832,17 @@ function directLoser(params) {
23818
23832
  });
23819
23833
  const relevantAssignment = sourcePositionAssignments?.find((assignment) => assignment.drawPosition === loserDrawPosition);
23820
23834
  const loserParticipantId = relevantAssignment?.participantId;
23835
+ const context = { loserParticipantId };
23821
23836
  const targetStructureId = loserTargetLink.target.structureId;
23822
23837
  const { positionAssignments: targetPositionAssignments } = structureAssignedDrawPositions({
23823
23838
  structureId: targetStructureId,
23824
23839
  drawDefinition,
23825
23840
  });
23826
23841
  const targetMatchUpPositionAssignments = targetPositionAssignments?.filter(({ drawPosition }) => targetMatchUpDrawPositions.includes(drawPosition));
23827
- const loserAlreadyDirected = targetMatchUpPositionAssignments?.some((assignment) => assignment.participantId === loserParticipantId);
23842
+ const loserAlreadyDirected = targetMatchUpPositionAssignments?.some((assignment) => assignment.participantId && loserParticipantId && assignment.participantId === loserParticipantId);
23843
+ const validExitToPropagate = propagateExitStatus && [RETIRED$1, WALKOVER$2, DEFAULTED].includes(sourceMatchUpStatus || '');
23828
23844
  if (loserAlreadyDirected) {
23829
- return { ...SUCCESS };
23845
+ return { ...SUCCESS, stack };
23830
23846
  }
23831
23847
  const unfilledTargetMatchUpDrawPositions = targetMatchUpPositionAssignments
23832
23848
  ?.filter((assignment) => {
@@ -23840,11 +23856,15 @@ function directLoser(params) {
23840
23856
  const isFirstRoundValidDrawPosition = loserTargetLink.target.roundNumber === 1 && targetDrawPositionIsUnfilled;
23841
23857
  if (fedDrawPositionFMLC) {
23842
23858
  const result = loserLinkFedFMLC();
23859
+ if (result.context)
23860
+ Object.assign(context, result.context);
23843
23861
  if (result.error)
23844
23862
  return decorateResult({ result, stack });
23845
23863
  }
23846
23864
  else if (isFirstRoundValidDrawPosition) {
23847
23865
  const result = asssignLoserDrawPosition();
23866
+ if (result.context)
23867
+ Object.assign(context, result.context);
23848
23868
  if (result.error)
23849
23869
  return decorateResult({ result, stack });
23850
23870
  }
@@ -23864,6 +23884,9 @@ function directLoser(params) {
23864
23884
  });
23865
23885
  if (result.error)
23866
23886
  return decorateResult({ result, stack });
23887
+ if (!result.error && validExitToPropagate && propagateExitStatus) {
23888
+ return { stack, context: { progressExitStatus: true, loserParticipantId } };
23889
+ }
23867
23890
  }
23868
23891
  else {
23869
23892
  const error = !targetDrawPositionIsUnfilled ? DRAW_POSITION_OCCUPIED : INVALID_DRAW_POSITION;
@@ -23912,7 +23935,7 @@ function directLoser(params) {
23912
23935
  }
23913
23936
  }
23914
23937
  }
23915
- return { ...SUCCESS };
23938
+ return { ...SUCCESS, stack, context };
23916
23939
  function loserLinkFedFMLC() {
23917
23940
  const stack = 'loserLinkFedFMLC';
23918
23941
  if (validForConsolation) {
@@ -23946,6 +23969,9 @@ function directLoser(params) {
23946
23969
  event,
23947
23970
  })
23948
23971
  : { error: MISSING_PARTICIPANT_ID };
23972
+ if (!result.error && validExitToPropagate && propagateExitStatus) {
23973
+ return { stack, context: { progressExitStatus: true } };
23974
+ }
23949
23975
  return decorateResult({ result, stack: 'assignLoserDrawPosition' });
23950
23976
  }
23951
23977
  }
@@ -23958,7 +23984,7 @@ function directParticipants(params) {
23958
23984
  const matchUpStatusIsValid = isDirectingMatchUpStatus({
23959
23985
  matchUpStatus: params.matchUpStatus,
23960
23986
  });
23961
- const { dualWinningSideChange, projectedWinningSide, inContextDrawMatchUps, tournamentRecord, drawDefinition, matchUpStatus, dualMatchUp, matchUpsMap, winningSide, targetData, matchUpId, structure, matchUp, event, } = params;
23987
+ const { dualWinningSideChange, inContextDrawMatchUps, projectedWinningSide, propagateExitStatus, matchUpStatusCodes, tournamentRecord, drawDefinition, matchUpStatus, dualMatchUp, matchUpsMap, winningSide, targetData, matchUpId, structure, matchUp, event, } = params;
23962
23988
  const isCollectionMatchUp = Boolean(matchUp.collectionId);
23963
23989
  const isAdHocMatchUp = isAdHoc({ structure });
23964
23990
  let drawPositions = matchUp.drawPositions;
@@ -23988,6 +24014,7 @@ function directParticipants(params) {
23988
24014
  const losingIndex = 1 - winningIndex;
23989
24015
  const winningDrawPosition = drawPositions[winningIndex];
23990
24016
  const loserDrawPosition = drawPositions[losingIndex];
24017
+ const context = {};
23991
24018
  const { targetLinks: { loserTargetLink, winnerTargetLink, byeTargetLink }, targetMatchUps: { winnerMatchUpDrawPositionIndex, loserMatchUpDrawPositionIndex, winnerMatchUp, loserMatchUp, byeMatchUp, }, } = targetData;
23992
24019
  if (winnerMatchUp) {
23993
24020
  const result = directWinner({
@@ -24014,6 +24041,7 @@ function directParticipants(params) {
24014
24041
  loserMatchUpDrawPositionIndex,
24015
24042
  inContextDrawMatchUps,
24016
24043
  projectedWinningSide,
24044
+ propagateExitStatus,
24017
24045
  loserDrawPosition,
24018
24046
  tournamentRecord,
24019
24047
  loserTargetLink,
@@ -24023,6 +24051,14 @@ function directParticipants(params) {
24023
24051
  dualMatchUp,
24024
24052
  event,
24025
24053
  });
24054
+ if (result.context?.progressExitStatus) {
24055
+ Object.assign(context, result.context, {
24056
+ sourceMatchUpStatus: (matchUpStatusIsValid && matchUpStatus) || COMPLETED$1,
24057
+ sourceMatchUpStatusCodes: matchUpStatusCodes || [],
24058
+ loserMatchUp,
24059
+ matchUpsMap,
24060
+ });
24061
+ }
24026
24062
  if (result.error)
24027
24063
  return decorateResult({ result, stack });
24028
24064
  }
@@ -24040,11 +24076,11 @@ function directParticipants(params) {
24040
24076
  if (result.error)
24041
24077
  return decorateResult({ result, stack });
24042
24078
  }
24079
+ return decorateResult({ result: { ...SUCCESS, ...annotate }, stack, context });
24043
24080
  }
24044
24081
  else {
24045
24082
  return decorateResult({ result: { error: MISSING_DRAW_POSITIONS }, stack });
24046
24083
  }
24047
- return decorateResult({ result: { ...SUCCESS, ...annotate }, stack });
24048
24084
  }
24049
24085
 
24050
24086
  function generateAndPopulatePlayoffStructures(params) {
@@ -25596,7 +25632,7 @@ function getValidModifyAssignedPairAction({ tournamentParticipants, returnPartic
25596
25632
  }
25597
25633
 
25598
25634
  function isActiveDownstream(params) {
25599
- const { inContextDrawMatchUps, targetData, drawDefinition, relevantLink } = params;
25635
+ const { inContextDrawMatchUps, targetData, drawDefinition, relevantLink, matchUpStatus, score, winningSide } = params;
25600
25636
  const fmlcBYE = relevantLink?.linkCondition === FIRST_MATCHUP && targetData?.matchUp?.matchUpStatus === BYE;
25601
25637
  if (fmlcBYE)
25602
25638
  return false;
@@ -25611,11 +25647,19 @@ function isActiveDownstream(params) {
25611
25647
  const loserIndex = loserTargetData?.targetMatchUps?.loserMatchUpDrawPositionIndex;
25612
25648
  const propagatedLoserParticipant = loserExitPropagation?.sides[loserIndex]?.participant;
25613
25649
  const loserMatchUpExit = [DEFAULTED, WALKOVER$2].includes(loserMatchUp?.matchUpStatus) && !propagatedLoserParticipant;
25650
+ const loserMatchUpParticipantsCount = loserMatchUp?.sides?.reduce((acc, current) => (current?.participant ? ++acc : acc), 0) ?? 0;
25651
+ const isLoserMatchUpAPropagatedExitStatus = loserMatchUp?.winningSide &&
25652
+ [DEFAULTED, WALKOVER$2].includes(loserMatchUp?.matchUpStatus) &&
25653
+ propagatedLoserParticipant &&
25654
+ loserMatchUpParticipantsCount === 1;
25655
+ const isClearScore = matchUpStatus === TO_BE_PLAYED && score?.scoreStringSide1 === '' && score?.scoreStringSide2 === '' && !winningSide;
25614
25656
  const winnerDrawPositionsCount = winnerMatchUp?.drawPositions?.filter(Boolean).length || 0;
25615
- if ((loserMatchUp?.winningSide && !loserMatchUpExit) ||
25616
- (winnerMatchUp?.winningSide &&
25617
- winnerDrawPositionsCount === 2 &&
25618
- (!winnerMatchUp.feedRound || ![WALKOVER$2, DEFAULTED].includes(winnerMatchUp?.matchUpStatus)))) {
25657
+ if ((isLoserMatchUpAPropagatedExitStatus && isClearScore) ||
25658
+ (!isLoserMatchUpAPropagatedExitStatus &&
25659
+ ((loserMatchUp?.winningSide && !loserMatchUpExit) ||
25660
+ (winnerMatchUp?.winningSide &&
25661
+ winnerDrawPositionsCount === 2 &&
25662
+ (!winnerMatchUp.feedRound || ![WALKOVER$2, DEFAULTED].includes(winnerMatchUp?.matchUpStatus)))))) {
25619
25663
  return true;
25620
25664
  }
25621
25665
  const winnerTargetData = winnerMatchUp &&
@@ -43379,11 +43423,6 @@ function removeDirectedLoser({ sourceMatchUpStatus, loserParticipantId, tourname
43379
43423
  function removeDirectedBye({ inContextDrawMatchUps, tournamentRecord, drawDefinition, drawPosition, matchUpsMap, targetLink, event, }) {
43380
43424
  const structureId = targetLink.target.structureId;
43381
43425
  const stack = 'removeDirectedBye';
43382
- pushGlobalLog({
43383
- color: 'brightyellow',
43384
- method: stack,
43385
- drawPosition,
43386
- });
43387
43426
  const result = clearDrawPosition({
43388
43427
  inContextDrawMatchUps,
43389
43428
  tournamentRecord,
@@ -43453,7 +43492,8 @@ function doubleExitAdvancement(params) {
43453
43492
  !loserMatchUp.sides?.map((side) => side.participantId ?? side.participant).filter(Boolean).length;
43454
43493
  if (loserMatchUp && loserMatchUp.matchUpStatus !== BYE) {
43455
43494
  const { loserTargetLink } = targetLinks;
43456
- if (appliedPolicies?.progression?.doubleExitPropagateBye) {
43495
+ if (appliedPolicies?.progression?.doubleExitPropagateBye ||
43496
+ (loserMatchUp.feedRound && loserMatchUp.sides?.[0]?.participantFed)) {
43457
43497
  const result = advanceByeToLoserMatchUp({
43458
43498
  loserTargetDrawPosition,
43459
43499
  tournamentRecord,
@@ -43773,8 +43813,9 @@ function attemptToSetMatchUpStatus(params) {
43773
43813
  (!directing && { error: UNRECOGNIZED_MATCHUP_STATUS }) ||
43774
43814
  (isDoubleExit && modifyScoreAndAdvanceDoubleExit(params)) ||
43775
43815
  (teamRoundRobinContext && scoreModification$1(params)) ||
43816
+ (params.propagateExitStatus && scoreModification$1(params)) ||
43776
43817
  decorateResult({
43777
- result: { error: INVALID_MATCHUP_STATUS },
43818
+ result: { error: INVALID_MATCHUP_STATUS, info: 'matchUpStatus: ' + matchUpStatus },
43778
43819
  stack,
43779
43820
  }));
43780
43821
  }
@@ -43986,6 +44027,7 @@ function placeQualifier(params) {
43986
44027
  function attemptToSetWinningSide(params) {
43987
44028
  const stack = 'attemptToSetWinningSide';
43988
44029
  let connectedStructures;
44030
+ const context = {};
43989
44031
  const { appliedPolicies, disableAutoCalc, drawDefinition, dualMatchUp, winningSide, structure, matchUp } = params;
43990
44032
  if (dualMatchUp?._disableAutoCalc && disableAutoCalc !== false) {
43991
44033
  return attemptToModifyScore(params);
@@ -44005,6 +44047,8 @@ function attemptToSetWinningSide(params) {
44005
44047
  return result;
44006
44048
  }
44007
44049
  const result = directParticipants(params);
44050
+ if (result.context?.progressExitStatus)
44051
+ Object.assign(context, result.context);
44008
44052
  if (result.error)
44009
44053
  return decorateResult({ result, stack });
44010
44054
  let qualifierReplaced, qualifierPlaced;
@@ -44021,41 +44065,19 @@ function attemptToSetWinningSide(params) {
44021
44065
  connectedStructures,
44022
44066
  qualifierReplaced,
44023
44067
  qualifierPlaced,
44068
+ context,
44024
44069
  }),
44025
44070
  stack,
44026
44071
  });
44027
44072
  }
44028
44073
 
44029
- const keyColors = {
44030
- drawPositionToRemove: 'green',
44031
- iteration: 'brightred',
44032
- winner: 'green',
44033
- loser: 'brightred',
44034
- };
44035
44074
  function removeDoubleExit(params) {
44036
44075
  const { inContextDrawMatchUps, appliedPolicies, drawDefinition, matchUpsMap, targetData, matchUp } = params;
44037
- const { matchUpId } = matchUp;
44038
44076
  let { iteration = 0 } = params;
44039
44077
  iteration += 1;
44040
44078
  const stack = 'removeDoubleExit';
44041
- pushGlobalLog({
44042
- color: 'brightyellow',
44043
- method: stack,
44044
- matchUpId,
44045
- iteration,
44046
- keyColors,
44047
- });
44048
44079
  const { targetMatchUps: { loserMatchUp, winnerMatchUp, loserTargetDrawPosition }, targetLinks: { loserTargetLink }, } = targetData;
44049
44080
  if (winnerMatchUp && winnerMatchUp.matchUpStatus !== BYE) {
44050
- const { stage, roundNumber, roundPosition, structureName } = winnerMatchUp;
44051
- pushGlobalLog({
44052
- winner: 'winner',
44053
- roundPosition,
44054
- structureName,
44055
- roundNumber,
44056
- keyColors,
44057
- stage,
44058
- });
44059
44081
  conditionallyRemoveDrawPosition({
44060
44082
  ...params,
44061
44083
  targetMatchUp: winnerMatchUp,
@@ -44083,16 +44105,6 @@ function removeDoubleExit(params) {
44083
44105
  drawDefinition,
44084
44106
  structureId: inContextLoserMatchUp.structureId,
44085
44107
  });
44086
- const { stage, roundNumber, roundPosition, feedRound, structureName } = loserMatchUp;
44087
- pushGlobalLog({
44088
- loser: 'loser',
44089
- roundPosition,
44090
- structureName,
44091
- roundNumber,
44092
- keyColors,
44093
- feedRound,
44094
- stage,
44095
- });
44096
44108
  if (appliedPolicies?.progression?.doubleExitPropagateBye || byePropagatedToLoserMatchUp) {
44097
44109
  removeDirectedBye({
44098
44110
  drawPosition: loserTargetDrawPosition,
@@ -44118,7 +44130,6 @@ function removeDoubleExit(params) {
44118
44130
  function conditionallyRemoveDrawPosition(params) {
44119
44131
  const { inContextDrawMatchUps, appliedPolicies, drawDefinition, sourceMatchUp, targetMatchUp, matchUpsMap, structure, iteration, } = params;
44120
44132
  const stack = 'conditionallyRemoveDrawPosition';
44121
- pushGlobalLog({ method: stack, structureName: structure?.structureName, iteration });
44122
44133
  const nextTargetData = positionTargets({
44123
44134
  matchUpId: targetMatchUp.matchUpId,
44124
44135
  inContextDrawMatchUps,
@@ -44158,17 +44169,6 @@ function conditionallyRemoveDrawPosition(params) {
44158
44169
  }
44159
44170
  }
44160
44171
  if (nextWinnerMatchUp && drawPositionToRemove) {
44161
- const { stage, roundNumber, roundPosition, structureName } = nextWinnerMatchUp;
44162
- pushGlobalLog({
44163
- method: 'removeDirectedWinner',
44164
- drawPositionToRemove,
44165
- color: 'brightgreen',
44166
- roundPosition,
44167
- structureName,
44168
- roundNumber,
44169
- keyColors,
44170
- stage,
44171
- });
44172
44172
  removeDirectedWinner({
44173
44173
  winningDrawPosition: drawPositionToRemove,
44174
44174
  winnerMatchUp: nextWinnerMatchUp,
@@ -44295,7 +44295,6 @@ function noDownstreamDependencies(params) {
44295
44295
  const removeScore = params.removeScore || (!timedTieMatchUp && ![INCOMPLETE, ABANDONED$1].includes(matchUpStatus || INCOMPLETE));
44296
44296
  const removeWinningSide = (params.isCollectionMatchUp && params.dualMatchUp.winningSide && !params.projectedWinningSide) ||
44297
44297
  (matchUp.winningSide && !winningSide && !checkScoreHasValue({ score }));
44298
- const statusNotTBP = matchUpStatus && matchUpStatus !== TO_BE_PLAYED;
44299
44298
  const removeDirected = (removeScore) => {
44300
44299
  let connectedStructures;
44301
44300
  const { structure, drawDefinition, dualMatchUp, disableAutoCalc } = params;
@@ -44325,9 +44324,11 @@ function noDownstreamDependencies(params) {
44325
44324
  return scoreModification(params);
44326
44325
  }
44327
44326
  const triggerDualWinningSide = [CANCELLED$1, ABANDONED$1].includes(matchUpStatus) && params.dualWinningSideChange;
44328
- const result = ((winningSide || triggerDualWinningSide) && attemptToSetWinningSide(params)) ||
44327
+ const statusNotToBePlayed = matchUpStatus && matchUpStatus !== TO_BE_PLAYED;
44328
+ const propagateExitStatus = params.propagateExitStatus && [WALKOVER$2, DEFAULTED].includes(matchUpStatus);
44329
+ const result = ((winningSide || triggerDualWinningSide || propagateExitStatus) && attemptToSetWinningSide(params)) ||
44329
44330
  (scoreWithNoWinningSide && removeDirected(removeScore)) ||
44330
- (statusNotTBP && attemptToSetMatchUpStatus(params)) ||
44331
+ (statusNotToBePlayed && attemptToSetMatchUpStatus(params)) ||
44331
44332
  (removeWinningSide && removeDirected(removeScore)) ||
44332
44333
  (matchUp && scoreModification({ ...params, removeScore: true })) || {
44333
44334
  ...SUCCESS,
@@ -45154,10 +45155,10 @@ function swapWinnerLoser(params) {
45154
45155
  }
45155
45156
 
45156
45157
  function setMatchUpState(params) {
45157
- const stack = 'setMatchUpStatus';
45158
+ const stack = 'setMatchUpState';
45158
45159
  if (params.matchUpStatus && [WALKOVER$2, DOUBLE_WALKOVER].includes(params.matchUpStatus))
45159
45160
  params.score = undefined;
45160
- const { allowChangePropagation, disableScoreValidation, tournamentRecords, tournamentRecord, disableAutoCalc, enableAutoCalc, drawDefinition, matchUpStatus, winningSide, matchUpId, event, score, } = params;
45161
+ const { allowChangePropagation, disableScoreValidation, propagateExitStatus, tournamentRecords, tournamentRecord, disableAutoCalc, enableAutoCalc, drawDefinition, matchUpStatus, winningSide, matchUpId, event, score, } = params;
45161
45162
  if (!drawDefinition)
45162
45163
  return { error: MISSING_DRAW_DEFINITION };
45163
45164
  if (matchUpStatus && [CANCELLED$1, INCOMPLETE, ABANDONED$1, TO_BE_PLAYED].includes(matchUpStatus) && winningSide)
@@ -45287,6 +45288,7 @@ function setMatchUpState(params) {
45287
45288
  Object.assign(appliedPolicies, params.policyDefinitions);
45288
45289
  const participantCheck = checkParticipants({
45289
45290
  assignedDrawPositions,
45291
+ propagateExitStatus,
45290
45292
  inContextMatchUp,
45291
45293
  appliedPolicies,
45292
45294
  drawDefinition,
@@ -45399,12 +45401,6 @@ function setMatchUpState(params) {
45399
45401
  return swapWinnerLoser(params);
45400
45402
  }
45401
45403
  const matchUpWinner = (winningSide && !matchUpTieId) || params.projectedWinningSide;
45402
- pushGlobalLog({
45403
- activeDownstream,
45404
- matchUpWinner,
45405
- method: stack,
45406
- winningSide,
45407
- });
45408
45404
  const result = (!activeDownstream && noDownstreamDependencies(params)) ||
45409
45405
  (matchUpWinner && winningSideWithDownstreamDependencies(params)) ||
45410
45406
  ((directingMatchUpStatus || params.autoCalcDisabled) && applyMatchUpValues(params)) || {
@@ -45460,7 +45456,7 @@ function applyMatchUpValues(params) {
45460
45456
  }
45461
45457
  return result;
45462
45458
  }
45463
- function checkParticipants({ assignedDrawPositions, inContextMatchUp, appliedPolicies, drawDefinition, matchUpStatus, structure, matchUp, }) {
45459
+ function checkParticipants({ assignedDrawPositions, propagateExitStatus, inContextMatchUp, appliedPolicies, drawDefinition, matchUpStatus, structure, matchUp, }) {
45464
45460
  if (appliedPolicies?.[POLICY_TYPE_SCORING]?.requireParticipantsForScoring === false)
45465
45461
  return { ...SUCCESS };
45466
45462
  const participantsCount = inContextMatchUp?.sides?.map((side) => side.participantId).filter(Boolean).length;
@@ -45476,10 +45472,16 @@ function checkParticipants({ assignedDrawPositions, inContextMatchUp, appliedPol
45476
45472
  positionAssignments
45477
45473
  ?.filter((assignment) => assignedDrawPositions.includes(assignment.drawPosition))
45478
45474
  .every((assignment) => assignment.participantId));
45475
+ if (matchUpStatus &&
45476
+ [WALKOVER$2, DEFAULTED, DOUBLE_WALKOVER].includes(matchUpStatus) &&
45477
+ participantsCount === 1 &&
45478
+ propagateExitStatus) {
45479
+ return { ...SUCCESS };
45480
+ }
45479
45481
  if (matchUpStatus && particicipantsRequiredMatchUpStatuses.includes(matchUpStatus) && !requiredParticipants) {
45480
45482
  return decorateResult({
45481
45483
  info: 'matchUpStatus requires assigned participants',
45482
- context: { matchUpStatus, requiredParticipants },
45484
+ context: { matchUpStatus, requiredParticipants, propagateExitStatus: propagateExitStatus, participantsCount },
45483
45485
  result: { error: INVALID_MATCHUP_STATUS },
45484
45486
  });
45485
45487
  }
@@ -45781,10 +45783,64 @@ function matchUpScore(params) {
45781
45783
  return { score: { sets, scoreStringSide1, scoreStringSide2 } };
45782
45784
  }
45783
45785
 
45786
+ function progressExitStatus({ sourceMatchUpStatusCodes, propagateExitStatus, sourceMatchUpStatus, loserParticipantId, tournamentRecord, drawDefinition, loserMatchUp, matchUpsMap, event, }) {
45787
+ const stack = 'progressExitStatus';
45788
+ const carryOverMatchUpStatus = ([WALKOVER$2, DEFAULTED].includes(sourceMatchUpStatus) && sourceMatchUpStatus) || WALKOVER$2;
45789
+ const inContextMatchUps = getAllDrawMatchUps({
45790
+ inContext: true,
45791
+ drawDefinition,
45792
+ matchUpsMap,
45793
+ })?.matchUps;
45794
+ let loserMatchUpStatus = carryOverMatchUpStatus;
45795
+ const updatedLoserMatchUp = inContextMatchUps?.find((m) => m.matchUpId === loserMatchUp?.matchUpId);
45796
+ if (updatedLoserMatchUp?.matchUpId && loserMatchUpStatus) {
45797
+ let winningSide = undefined;
45798
+ const statusCodes = updatedLoserMatchUp.matchUpStatusCodes?.map((sc) => (typeof sc === 'string' ? sc : 'WO')) ?? [];
45799
+ const loserParticipantSide = updatedLoserMatchUp.sides?.find((s) => s.participantId === loserParticipantId);
45800
+ if (loserParticipantSide?.sideNumber) {
45801
+ const participantsCount = updatedLoserMatchUp?.sides?.reduce((count, current) => {
45802
+ return current?.participantId ? count + 1 : count;
45803
+ }, 0);
45804
+ if (participantsCount === 1 && statusCodes.length === 0) {
45805
+ winningSide = loserParticipantSide.sideNumber === 1 ? 2 : 1;
45806
+ statusCodes[0] = sourceMatchUpStatusCodes[0];
45807
+ }
45808
+ else {
45809
+ if (![WALKOVER$2, DEFAULTED].includes(loserMatchUp.matchUpStatus)) {
45810
+ winningSide = loserParticipantSide.sideNumber === 1 ? 2 : 1;
45811
+ statusCodes[0] = sourceMatchUpStatusCodes[0];
45812
+ }
45813
+ else {
45814
+ const currentStatusCode = statusCodes[0];
45815
+ statusCodes[loserParticipantSide.sideNumber - 1] = sourceMatchUpStatusCodes[0];
45816
+ const otherSide = loserParticipantSide.sideNumber === 1 ? 2 : 1;
45817
+ statusCodes[otherSide - 1] = currentStatusCode;
45818
+ loserMatchUpStatus = DOUBLE_WALKOVER;
45819
+ winningSide = undefined;
45820
+ }
45821
+ }
45822
+ }
45823
+ const result = setMatchUpState({
45824
+ matchUpStatus: loserMatchUpStatus,
45825
+ matchUpId: loserMatchUp.matchUpId,
45826
+ matchUpStatusCodes: statusCodes,
45827
+ allowChangePropagation: true,
45828
+ propagateExitStatus,
45829
+ tournamentRecord,
45830
+ drawDefinition,
45831
+ winningSide,
45832
+ event,
45833
+ });
45834
+ return decorateResult({ result, stack, context: { progressExitStatus: true } });
45835
+ }
45836
+ return decorateResult({ result: { error: MISSING_MATCHUP }, stack });
45837
+ }
45838
+
45784
45839
  function setMatchUpStatus(params) {
45785
45840
  const paramsCheck = checkRequiredParameters(params, [{ [MATCHUP_ID]: true, [DRAW_DEFINITION]: true }]);
45786
45841
  if (paramsCheck.error)
45787
45842
  return paramsCheck;
45843
+ const stack = 'setMatchUpStatus';
45788
45844
  const tournamentRecords = resolveTournamentRecords(params);
45789
45845
  if (!params.drawDefinition) {
45790
45846
  const tournamentRecord = params.tournamentRecord ?? (params.tournamentId && tournamentRecords[params.tournamentId]);
@@ -45796,12 +45852,12 @@ function setMatchUpStatus(params) {
45796
45852
  tournamentRecord,
45797
45853
  });
45798
45854
  if (result.error)
45799
- return result;
45855
+ return decorateResult({ stack, result });
45800
45856
  if (result.drawDefinition)
45801
45857
  params.drawDefinition = result.drawDefinition;
45802
45858
  params.event = result.event;
45803
45859
  }
45804
- const { disableScoreValidation, policyDefinitions, tournamentRecord, disableAutoCalc, enableAutoCalc, drawDefinition, matchUpId, schedule, event, notes, } = params;
45860
+ const { disableScoreValidation, propagateExitStatus, policyDefinitions, tournamentRecord, disableAutoCalc, enableAutoCalc, drawDefinition, matchUpId, schedule, event, notes, } = params;
45805
45861
  const matchUpFormat = params.matchUpFormat || params.outcome?.matchUpFormat;
45806
45862
  const { policy } = findPolicy({
45807
45863
  policyType: POLICY_TYPE_SCORING,
@@ -45813,7 +45869,7 @@ function setMatchUpStatus(params) {
45813
45869
  undefined;
45814
45870
  const { outcome, setTBlast } = params;
45815
45871
  if (outcome?.winningSide && ![1, 2].includes(outcome.winningSide)) {
45816
- return { error: INVALID_WINNING_SIDE };
45872
+ return decorateResult({ result: { error: INVALID_WINNING_SIDE }, stack });
45817
45873
  }
45818
45874
  if (matchUpFormat) {
45819
45875
  const result = setMatchUpMatchUpFormat({
@@ -45824,20 +45880,21 @@ function setMatchUpStatus(params) {
45824
45880
  event,
45825
45881
  });
45826
45882
  if (result.error)
45827
- return result;
45883
+ return decorateResult({ stack, result });
45828
45884
  }
45829
45885
  if (outcome?.score?.sets && !outcome.score.scoreStringSide1) {
45830
45886
  const { score: scoreObject } = matchUpScore({ ...outcome, setTBlast });
45831
45887
  outcome.score = scoreObject;
45832
45888
  outcome.score.sets = outcome.score.sets.filter((set) => set.side1Score || set.side2Score || set.side1TiebreakScore || set.side2TiebreakScore);
45833
45889
  }
45834
- return setMatchUpState({
45890
+ const result = setMatchUpState({
45835
45891
  matchUpStatusCodes: outcome?.matchUpStatusCodes,
45836
45892
  matchUpStatus: outcome?.matchUpStatus,
45837
45893
  winningSide: outcome?.winningSide,
45838
45894
  allowChangePropagation,
45839
45895
  disableScoreValidation,
45840
45896
  score: outcome?.score,
45897
+ propagateExitStatus,
45841
45898
  tournamentRecords,
45842
45899
  policyDefinitions,
45843
45900
  tournamentRecord,
@@ -45850,6 +45907,30 @@ function setMatchUpStatus(params) {
45850
45907
  event,
45851
45908
  notes,
45852
45909
  });
45910
+ if (result.context?.progressExitStatus) {
45911
+ let iterate = true;
45912
+ let failsafe = 0;
45913
+ while (iterate && failsafe < 10) {
45914
+ iterate = false;
45915
+ failsafe += 1;
45916
+ const progressResult = progressExitStatus({
45917
+ sourceMatchUpStatusCodes: result.context.sourceMatchUpStatusCodes,
45918
+ sourceMatchUpStatus: result.context.sourceMatchUpStatus,
45919
+ loserParticipantId: result.context.loserParticipantId,
45920
+ propagateExitStatus: params.propagateExitStatus,
45921
+ tournamentRecord: params.tournamentRecord,
45922
+ loserMatchUp: result.context.loserMatchUp,
45923
+ matchUpsMap: result.context.matchUpsMap,
45924
+ drawDefinition: params.drawDefinition,
45925
+ event: params.event,
45926
+ });
45927
+ if (progressResult.context?.loserMatchUp) {
45928
+ Object.assign(result.context, progressResult.context);
45929
+ iterate = true;
45930
+ }
45931
+ }
45932
+ }
45933
+ return decorateResult({ result, stack });
45853
45934
  }
45854
45935
 
45855
45936
  function bulkMatchUpStatusUpdate(params) {
@@ -46972,7 +47053,7 @@ function getGroupedRounds({ scheduledRoundsDetails, greatestAverageMinutes, garm
46972
47053
  if (roundDetails.hash === lastHash || garmanSinglePass) {
46973
47054
  groupedMatchUpIds = groupedMatchUpIds.concat(roundDetails.matchUpIds);
46974
47055
  }
46975
- if (roundDetails.hash !== lastHash && false) ;
47056
+ if (roundDetails.hash !== lastHash && !garmanSinglePass) ;
46976
47057
  averageMinutes = greatestAverageMinutes ;
46977
47058
  recoveryMinutes = roundDetails.recoveryMinutes;
46978
47059
  roundPeriodLength = roundDetails.roundPeriodLength;