tods-competition-factory 2.0.12 → 2.0.13

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.
@@ -3497,10 +3497,9 @@ declare function getParticipantTimeItem({ returnPreviousValues, tournamentRecord
3497
3497
  };
3498
3498
 
3499
3499
  type IsAdHocArgs = {
3500
- drawDefinition?: DrawDefinition;
3501
3500
  structure?: any;
3502
3501
  };
3503
- declare function isAdHoc({ drawDefinition, structure }: IsAdHocArgs): boolean;
3502
+ declare function isAdHoc({ structure }: IsAdHocArgs): boolean;
3504
3503
 
3505
3504
  declare const query$a_allPlayoffPositionsFilled: typeof allPlayoffPositionsFilled;
3506
3505
  declare const query$a_checkValidEntries: typeof checkValidEntries;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  function factoryVersion() {
6
- return '2.0.12';
6
+ return '2.0.13';
7
7
  }
8
8
 
9
9
  const SUCCESS = { success: true };
@@ -2209,6 +2209,7 @@ const errors = {
2209
2209
  [POLICY_DEFINITIONS]: MISSING_POLICY_DEFINITION,
2210
2210
  [DRAW_DEFINITION]: MISSING_DRAW_DEFINITION,
2211
2211
  [PARTICIPANT_ID]: MISSING_PARTICIPANT_ID,
2212
+ [MATCHUP_FORMAT]: MISSING_MATCHUP_FORMAT,
2212
2213
  [TOURNAMENT_ID]: MISSING_TOURNAMENT_ID,
2213
2214
  [STRUCTURE_ID]: MISSING_STRUCTURE_ID,
2214
2215
  [MATCHUP_IDS]: MISSING_MATCHUP_IDS,
@@ -2252,7 +2253,7 @@ function checkRequiredParameters(params, requiredParams, stack) {
2252
2253
  const { paramError, errorParam } = findParamError(params, requiredParams);
2253
2254
  if (!paramError)
2254
2255
  return { valid: true };
2255
- const error = params[errorParam] === undefined
2256
+ const error = params?.[errorParam] === undefined
2256
2257
  ? errors[errorParam] || INVALID_VALUES
2257
2258
  : (paramError.validate && paramError.invalid) || INVALID_VALUES;
2258
2259
  return decorateResult({
@@ -6594,17 +6595,16 @@ function isLucky({ roundsNotPowerOf2, drawDefinition, structure, matchUps }) {
6594
6595
  hasDrawPositions);
6595
6596
  }
6596
6597
 
6597
- function isAdHoc({ drawDefinition, structure }) {
6598
+ function isAdHoc({ structure }) {
6598
6599
  if (!structure)
6599
6600
  return false;
6600
6601
  const matchUps = structure.matchUps || (structure.roundMatchUps && Object.values(structure.roundMatchUps).flat());
6601
- const hasRoundPosition = matchUps?.find((matchUp) => matchUp?.roundPosition);
6602
- const hasDrawPosition = matchUps?.find((matchUp) => matchUp?.drawPositions?.length);
6603
- return (!structure?.structures &&
6602
+ const hasRoundPosition = !!matchUps?.find((matchUp) => matchUp?.roundPosition);
6603
+ const hasDrawPosition = !!matchUps?.find((matchUp) => matchUp?.drawPositions?.length);
6604
+ const adHoc = !structure?.structures &&
6604
6605
  structure?.stage !== VOLUNTARY_CONSOLATION &&
6605
- !(drawDefinition?.drawType && drawDefinition.drawType !== AD_HOC) &&
6606
- !hasRoundPosition &&
6607
- !hasDrawPosition);
6606
+ (!matchUps.length || (!hasRoundPosition && !hasDrawPosition));
6607
+ return adHoc;
6608
6608
  }
6609
6609
 
6610
6610
  const POLICY_ROUND_NAMING_DEFAULT = {
@@ -9785,6 +9785,9 @@ function allEventMatchUps(params) {
9785
9785
  }
9786
9786
 
9787
9787
  function allTournamentMatchUps(params) {
9788
+ const paramsCheck = checkRequiredParameters(params, [{ tournamentRecord: true }]);
9789
+ if (paramsCheck.error)
9790
+ return paramsCheck;
9788
9791
  if (!params?.tournamentRecord)
9789
9792
  return { error: MISSING_TOURNAMENT_RECORD };
9790
9793
  let { participantMap, participants } = params;
@@ -10141,7 +10144,7 @@ function getStructureDrawPositionProfiles(params) {
10141
10144
  return result;
10142
10145
  structure = findContainer ? result.containingStructure ?? result.structure : result.structure;
10143
10146
  }
10144
- if (isAdHoc({ drawDefinition, structure })) {
10147
+ if (isAdHoc({ structure })) {
10145
10148
  return { structure, isAdHoc: true, error: INVALID_DRAW_POSITION };
10146
10149
  }
10147
10150
  const { matchUps: inContextDrawMatchUps } = getAllDrawMatchUps({
@@ -12551,7 +12554,7 @@ function addDrawEntry(params) {
12551
12554
  drawDefinition,
12552
12555
  entryStatus,
12553
12556
  });
12554
- if (!ignoreStageSpace && !spaceAvailable.success) {
12557
+ if (!ignoreStageSpace && !spaceAvailable.success && (!drawType || drawType !== AD_HOC)) {
12555
12558
  return { error: spaceAvailable.error };
12556
12559
  }
12557
12560
  if (extension && !isValidExtension({ extension }))
@@ -14838,7 +14841,7 @@ function assignDrawPosition$1({ provisionalPositioning, inContextDrawMatchUps, i
14838
14841
  const { structure } = result;
14839
14842
  if (!structure)
14840
14843
  return { error: STRUCTURE_NOT_FOUND };
14841
- if (isAdHoc({ drawDefinition, structure }))
14844
+ if (isAdHoc({ structure }))
14842
14845
  return decorateResult({ result: { error: INVALID_MATCHUP }, stack });
14843
14846
  const { seedAssignments } = getStructureSeedAssignments({
14844
14847
  provisionalPositioning,
@@ -19578,18 +19581,18 @@ function calculatePercentages({ participantResults, matchUpFormat, tallyPolicy,
19578
19581
  function getParticipantResults({ participantIds, matchUpFormat, tallyPolicy, perPlayer, matchUps, }) {
19579
19582
  const participantResults = {};
19580
19583
  const excludeMatchUpStatuses = tallyPolicy?.excludeMatchUpStatuses || [];
19581
- const filteredMatchUps = matchUps.filter((matchUp) => {
19584
+ const filteredMatchUps = matchUps?.filter((matchUp) => {
19582
19585
  return ((matchUp.tieMatchUps || !excludeMatchUpStatuses.includes(matchUp.matchUpStatus)) &&
19583
19586
  (!participantIds?.length ||
19584
19587
  intersection(participantIds, [getSideId(matchUp, 0), getSideId(matchUp, 1)]).length === 2));
19585
19588
  });
19586
- const allSets = filteredMatchUps.flatMap(({ score, tieMatchUps }) => tieMatchUps
19589
+ const allSets = filteredMatchUps?.flatMap(({ score, tieMatchUps }) => tieMatchUps
19587
19590
  ? tieMatchUps
19588
19591
  .filter(({ matchUpStatus }) => !excludeMatchUpStatuses.includes(matchUpStatus))
19589
19592
  .flatMap(({ score }) => score?.sets?.length ?? 0)
19590
19593
  : score?.sets?.length ?? 0);
19591
- const totalSets = allSets.reduce((a, b) => a + b, 0);
19592
- for (const matchUp of filteredMatchUps) {
19594
+ const totalSets = allSets?.reduce((a, b) => a + b, 0);
19595
+ for (const matchUp of filteredMatchUps ?? []) {
19593
19596
  const { matchUpStatus, tieMatchUps, tieFormat, score, winningSide, sides } = matchUp;
19594
19597
  const manualGamesOverride = tieFormat && matchUp._disableAutoCalc && tieFormat.collectionDefinitions.every(({ scoreValue }) => scoreValue);
19595
19598
  const winningParticipantId = winningSide && getWinningSideId(matchUp);
@@ -20486,7 +20489,7 @@ function modifyMatchUpScore(params) {
20486
20489
  }
20487
20490
  if (!matchUp.collectionId) {
20488
20491
  const isRoundRobin = structure?.structureType === CONTAINER;
20489
- const isAdHocStructure = isAdHoc({ drawDefinition, structure });
20492
+ const isAdHocStructure = isAdHoc({ structure });
20490
20493
  if (isLucky({ drawDefinition, structure }) || isAdHocStructure || isRoundRobin) {
20491
20494
  const updateTally = (structure) => {
20492
20495
  matchUpFormat = isDualMatchUp
@@ -20571,12 +20574,12 @@ function modifyMatchUpScore(params) {
20571
20574
  }
20572
20575
 
20573
20576
  function attemptToModifyScore(params) {
20574
- const { dualWinningSideChange, matchUpStatusCodes, drawDefinition, matchUpStatus, structure, matchUp } = params;
20577
+ const { dualWinningSideChange, matchUpStatusCodes, matchUpStatus, structure, matchUp } = params;
20575
20578
  const matchUpStatusIsValid = isDirectingMatchUpStatus({ matchUpStatus }) ||
20576
20579
  ([CANCELLED$1, ABANDONED$1].includes(matchUpStatus) && dualWinningSideChange);
20577
20580
  const stack = 'attemptToModifyScore';
20578
20581
  const isCollectionMatchUp = Boolean(matchUp.collectionId);
20579
- const isAdHocMatchUp = isAdHoc({ drawDefinition, structure });
20582
+ const isAdHocMatchUp = isAdHoc({ structure });
20580
20583
  const validToScore = isCollectionMatchUp || isAdHocMatchUp || drawPositionsAssignedParticipantIds({ structure, matchUp });
20581
20584
  if (!validToScore) {
20582
20585
  return { error: MISSING_ASSIGNMENTS };
@@ -21903,7 +21906,7 @@ function directParticipants(params) {
21903
21906
  const { dualWinningSideChange, projectedWinningSide, inContextDrawMatchUps, tournamentRecord, drawDefinition, matchUpStatus, dualMatchUp, matchUpsMap, winningSide, targetData, matchUpId, structure, matchUp, event, } = params;
21904
21907
  const stack = 'directParticipants';
21905
21908
  const isCollectionMatchUp = Boolean(matchUp.collectionId);
21906
- const isAdHocMatchUp = isAdHoc({ drawDefinition, structure });
21909
+ const isAdHocMatchUp = isAdHoc({ structure });
21907
21910
  let drawPositions = matchUp.drawPositions;
21908
21911
  let annotate;
21909
21912
  if (isCollectionMatchUp) {
@@ -22841,12 +22844,18 @@ function deleteAdHocMatchUps(params) {
22841
22844
  .flatMap((matchUp) => (matchUp.sides ?? []).map((side) => side.participantId))
22842
22845
  .filter(Boolean)).map((participantId) => ({ participantId }));
22843
22846
  const matchUpFormat = structure?.matchUpFormat ?? drawDefinition?.matchUpFormat ?? event?.matchUpFormat;
22847
+ const { matchUps } = getAllStructureMatchUps({
22848
+ afterRecoveryTimes: false,
22849
+ inContext: true,
22850
+ structure,
22851
+ event,
22852
+ });
22844
22853
  const result = updateAssignmentParticipantResults({
22845
22854
  positionAssignments: structure.positionAssignments,
22846
- matchUps: structure.matchUps,
22847
22855
  tournamentRecord,
22848
22856
  drawDefinition,
22849
22857
  matchUpFormat,
22858
+ matchUps,
22850
22859
  event,
22851
22860
  });
22852
22861
  if (result.error)
@@ -22877,7 +22886,7 @@ function removeRoundMatchUps({ removeCompletedMatchUps, tournamentRecord, drawDe
22877
22886
  const structure = structureResult.structure;
22878
22887
  if (structure?.structures)
22879
22888
  return { error: INVALID_STRUCTURE };
22880
- const isAdHocStructure = isAdHoc({ drawDefinition, structure });
22889
+ const isAdHocStructure = isAdHoc({ structure });
22881
22890
  if (isAdHocStructure) {
22882
22891
  return removeAdHocRound({
22883
22892
  tournamentId: tournamentRecord.tournamentId,
@@ -24367,7 +24376,7 @@ function adHocMatchUpActions({ restrictAdHocRoundParticipants, tournamentPartici
24367
24376
  function matchUpActions(params) {
24368
24377
  if (!params)
24369
24378
  return { error: INVALID_VALUES };
24370
- let drawDefinition, event;
24379
+ let { drawDefinition, event } = params;
24371
24380
  const { restrictAdHocRoundParticipants = true, policyDefinitions: specifiedPolicyDefinitions, enforceGender, participantId, sideNumber, matchUpId, } = params;
24372
24381
  const tournamentRecord = params.tournamentRecord ??
24373
24382
  (params.tournamentId && isString(params.tournamentId) && params.tournamentRecords?.[params.tournamentId]);
@@ -24384,13 +24393,15 @@ function matchUpActions(params) {
24384
24393
  const matchUps = allTournamentMatchUps({ tournamentRecord }).matchUps ?? [];
24385
24394
  const matchUp = matchUps.find((matchUp) => matchUp.matchUpId === matchUpId);
24386
24395
  event = (tournamentRecord?.events ?? []).find((event) => event.eventId === matchUp?.eventId);
24387
- drawDefinition = (event?.drawDefinitions ?? []).find((drawDefinition) => drawDefinition.drawId === matchUp?.drawId);
24396
+ const foundDrawDefinition = (event?.drawDefinitions ?? []).find((drawDefinition) => drawDefinition.drawId === matchUp?.drawId);
24397
+ if (foundDrawDefinition)
24398
+ drawDefinition = foundDrawDefinition;
24388
24399
  }
24389
24400
  if (!drawDefinition)
24390
24401
  return { error: MISSING_DRAW_DEFINITION };
24391
24402
  const tournamentParticipants = getParticipants({
24392
- tournamentRecord,
24393
24403
  withIndividualParticipants: true,
24404
+ tournamentRecord,
24394
24405
  }).participants;
24395
24406
  const { drawId } = drawDefinition;
24396
24407
  const { matchUp, structure } = findDrawMatchUp({
@@ -24439,7 +24450,7 @@ function matchUpActions(params) {
24439
24450
  const validActions = [];
24440
24451
  if (!structureId)
24441
24452
  return { validActions };
24442
- const isAdHocMatchUp = isAdHoc({ drawDefinition, structure });
24453
+ const isAdHocMatchUp = isAdHoc({ structure });
24443
24454
  const isCollectionMatchUp = matchUp.collectionId;
24444
24455
  if (isAdHocMatchUp && !isCollectionMatchUp) {
24445
24456
  const adHocValidActions = adHocMatchUpActions({
@@ -24580,6 +24591,7 @@ function matchUpActions(params) {
24580
24591
  structureIsComplete,
24581
24592
  validActions,
24582
24593
  isDoubleExit,
24594
+ ...SUCCESS,
24583
24595
  };
24584
24596
  }
24585
24597
 
@@ -24635,13 +24647,10 @@ function getValidSwapAction({ onlyAssignedPositions = true, possiblyDisablingAct
24635
24647
  }
24636
24648
 
24637
24649
  function positionActions(params) {
24650
+ const paramsCheck = checkRequiredParameters(params, [{ event: true, drawDefinition: true, structureId: true }]);
24651
+ if (paramsCheck.error)
24652
+ return paramsCheck;
24638
24653
  const { policyDefinitions: specifiedPolicyDefinitions, returnParticipants = true, provisionalPositioning, tournamentRecord, drawDefinition, drawPosition, event, } = params;
24639
- if (!event)
24640
- return { error: MISSING_EVENT };
24641
- if (!drawDefinition)
24642
- return { error: MISSING_DRAW_DEFINITION };
24643
- if (!params.structureId)
24644
- return { error: MISSING_STRUCTURE_ID };
24645
24654
  const tournamentParticipants = params.tournamentParticipants ??
24646
24655
  (tournamentRecord &&
24647
24656
  getParticipants({
@@ -24973,6 +24982,7 @@ function positionActions(params) {
24973
24982
  isDrawPosition: true,
24974
24983
  isByePosition,
24975
24984
  validActions,
24985
+ ...SUCCESS,
24976
24986
  };
24977
24987
  }
24978
24988
 
@@ -35119,13 +35129,13 @@ function getStructure(params) {
35119
35129
  ?.filter((structure) => structure.stageSequence === 1)
35120
35130
  ?.reduce((targetStructure, structure) => {
35121
35131
  const orderNumber = structure.stage && stageOrder$1[structure.stage];
35122
- const structureIsAdHoc = isAdHoc({ drawDefinition, structure });
35132
+ const structureIsAdHoc = isAdHoc({ structure });
35123
35133
  return structureIsAdHoc && orderNumber > (stageOrder$1[targetStructure?.stage] || 1) ? structure : targetStructure;
35124
35134
  }, undefined);
35125
35135
  const structure = drawDefinition?.structures?.find((structure) => structure.structureId === targetStructure?.structureId);
35126
35136
  if (!structure)
35127
35137
  return { error: STRUCTURE_NOT_FOUND };
35128
- const structureIsAdHoc = isAdHoc({ drawDefinition, structure });
35138
+ const structureIsAdHoc = isAdHoc({ structure });
35129
35139
  if (!structureIsAdHoc)
35130
35140
  return { error: INVALID_DRAW_DEFINITION };
35131
35141
  return { structure };
@@ -35516,10 +35526,9 @@ function newDrawDefinition(params) {
35516
35526
  function setMatchUpMatchUpFormat(params) {
35517
35527
  let structureIds = params.structureIds;
35518
35528
  const { tournamentRecord, drawDefinition, matchUpFormat, structureId, matchUpId, event } = params;
35519
- if (!drawDefinition)
35520
- return { error: MISSING_DRAW_DEFINITION };
35521
- if (!matchUpFormat)
35522
- return { error: MISSING_MATCHUP_FORMAT };
35529
+ const paramsCheck = checkRequiredParameters(params, [{ [DRAW_DEFINITION]: true, [MATCHUP_FORMAT]: true }]);
35530
+ if (paramsCheck.error)
35531
+ return paramsCheck;
35523
35532
  if (!isValidMatchUpFormat({ matchUpFormat }))
35524
35533
  return { error: UNRECOGNIZED_MATCHUP_FORMAT };
35525
35534
  const stack = 'setMatchUpFormat';
@@ -36725,22 +36734,19 @@ function getDrawData(params) {
36725
36734
  const { positionAssignments } = getPositionAssignments$1({
36726
36735
  structure,
36727
36736
  });
36728
- let participantResults = positionAssignments
36729
- ?.filter(xa(PARTICIPANT_ID))
36730
- .map((assignment) => {
36731
- participantPlacements = true;
36737
+ let participantResults = positionAssignments?.filter(xa(PARTICIPANT_ID)).map((assignment) => {
36732
36738
  const { drawPosition, participantId } = assignment;
36733
36739
  const { extension } = findExtension({
36734
36740
  element: assignment,
36735
36741
  name: TALLY,
36736
36742
  });
36737
- return (extension && {
36738
- drawPosition,
36743
+ participantPlacements = true;
36744
+ return {
36745
+ participantResult: extension?.value,
36739
36746
  participantId,
36740
- participantResult: extension.value,
36741
- });
36742
- })
36743
- .filter((f) => f?.participantResult);
36747
+ drawPosition,
36748
+ };
36749
+ });
36744
36750
  if (!participantResults?.length && matchUps.length && params.allParticipantResults) {
36745
36751
  const { subOrderMap } = createSubOrderMap({ positionAssignments });
36746
36752
  const result = tallyParticipantResults({
@@ -36749,17 +36755,15 @@ function getDrawData(params) {
36749
36755
  subOrderMap,
36750
36756
  matchUps,
36751
36757
  });
36752
- participantResults = positionAssignments
36753
- ?.map((assignment) => {
36758
+ participantResults = positionAssignments?.filter(xa(PARTICIPANT_ID)).map((assignment) => {
36754
36759
  const { drawPosition, participantId } = assignment;
36755
- return (participantId &&
36756
- result.participantResults?.[participantId] && {
36757
- participantResult: result.participantResults[participantId],
36760
+ participantPlacements = true;
36761
+ return {
36762
+ participantResult: participantId && result.participantResults[participantId],
36758
36763
  participantId,
36759
36764
  drawPosition,
36760
- });
36761
- })
36762
- .filter((f) => f?.participantResult);
36765
+ };
36766
+ });
36763
36767
  }
36764
36768
  const structureInfo = structure
36765
36769
  ? (({ stageSequence, structureName, structureType, matchUpFormat, stage }) => ({
@@ -40486,7 +40490,7 @@ function removeDrawPosition({ inContextDrawMatchUps, positionAssignments, source
40486
40490
  function removeDirectedParticipants(params) {
40487
40491
  const { dualWinningSideChange, inContextDrawMatchUps, tournamentRecord, drawDefinition, matchUpStatus, matchUpsMap, dualMatchUp, targetData, matchUpId, structure, event, } = params;
40488
40492
  const isCollectionMatchUp = Boolean(params.matchUp.collectionId);
40489
- const isAdHocMatchUp = isAdHoc({ drawDefinition, structure });
40493
+ const isAdHocMatchUp = isAdHoc({ structure });
40490
40494
  const { drawPositions, winningSide } = targetData.matchUp || {};
40491
40495
  if (!isAdHocMatchUp && !drawPositions) {
40492
40496
  return { error: MISSING_DRAW_POSITIONS };
@@ -42974,6 +42978,9 @@ function matchUpScore(params) {
42974
42978
  }
42975
42979
 
42976
42980
  function setMatchUpStatus(params) {
42981
+ const paramsCheck = checkRequiredParameters(params, [{ [MATCHUP_ID]: true, [DRAW_DEFINITION]: true }]);
42982
+ if (paramsCheck.error)
42983
+ return paramsCheck;
42977
42984
  const tournamentRecords = resolveTournamentRecords(params);
42978
42985
  if (!params.drawDefinition) {
42979
42986
  const tournamentRecord = params.tournamentRecord ?? (params.tournamentId && tournamentRecords[params.tournamentId]);
@@ -42991,10 +42998,6 @@ function setMatchUpStatus(params) {
42991
42998
  params.event = result.event;
42992
42999
  }
42993
43000
  const { disableScoreValidation, policyDefinitions, tournamentRecord, disableAutoCalc, enableAutoCalc, drawDefinition, matchUpFormat, matchUpId, schedule, event, notes, } = params;
42994
- if (!drawDefinition)
42995
- return { error: MISSING_DRAW_ID };
42996
- if (!matchUpId)
42997
- return { error: MISSING_MATCHUP_ID };
42998
43001
  const { policy } = findPolicy({
42999
43002
  policyType: POLICY_TYPE_SCORING,
43000
43003
  tournamentRecord,
@@ -43004,6 +43007,9 @@ function setMatchUpStatus(params) {
43004
43007
  (policy?.allowChangePropagation !== undefined && policy.allowChangePropagation) ||
43005
43008
  undefined;
43006
43009
  const { outcome } = params;
43010
+ if (outcome?.winningSide && ![1, 2].includes(outcome.winningSide)) {
43011
+ return { error: INVALID_WINNING_SIDE };
43012
+ }
43007
43013
  if (matchUpFormat) {
43008
43014
  const result = setMatchUpMatchUpFormat({
43009
43015
  tournamentRecord,
@@ -52977,6 +52983,31 @@ function modifyCollectionDefinition({ updateInProgressMatchUps = false, tourname
52977
52983
  return decorateResult({ result: { ...result, modifications }, stack });
52978
52984
  }
52979
52985
 
52986
+ function getTargetTeamMatchUps({ updateInProgressMatchUps, drawDefinition, structureId, structure, matchUpId, matchUp, }) {
52987
+ let matchUps = [];
52988
+ if (matchUpId && matchUp) {
52989
+ matchUps = [matchUp];
52990
+ }
52991
+ else if (structureId && structure) {
52992
+ matchUps =
52993
+ getAllStructureMatchUps({
52994
+ matchUpFilters: { matchUpTypes: [TEAM$1] },
52995
+ structure,
52996
+ })?.matchUps ?? [];
52997
+ }
52998
+ else if (drawDefinition) {
52999
+ matchUps =
53000
+ allDrawMatchUps({
53001
+ matchUpFilters: { matchUpTypes: [TEAM$1] },
53002
+ drawDefinition,
53003
+ })?.matchUps ?? [];
53004
+ }
53005
+ const targetMatchUps = matchUps.filter((matchUp) => !matchUp.winningSide &&
53006
+ matchUp.matchUpStatus !== COMPLETED$1 &&
53007
+ (updateInProgressMatchUps || (matchUp.matchUpStatus !== IN_PROGRESS$1 && !checkScoreHasValue(matchUp))));
53008
+ return { targetMatchUps };
53009
+ }
53010
+
52980
53011
  function updateTargetTeamMatchUps({ updateInProgressMatchUps, tournamentRecord, drawDefinition, targetMatchUps, tieFormat, event, }) {
52981
53012
  for (const targetMatchUp of targetMatchUps) {
52982
53013
  const hasTieFormat = !!targetMatchUp.tieFormat;
@@ -53011,31 +53042,6 @@ function updateTargetTeamMatchUps({ updateInProgressMatchUps, tournamentRecord,
53011
53042
  return { ...SUCCESS };
53012
53043
  }
53013
53044
 
53014
- function getTargetTeamMatchUps({ updateInProgressMatchUps, drawDefinition, structureId, structure, matchUpId, matchUp, }) {
53015
- let matchUps = [];
53016
- if (matchUpId && matchUp) {
53017
- matchUps = [matchUp];
53018
- }
53019
- else if (structureId && structure) {
53020
- matchUps =
53021
- getAllStructureMatchUps({
53022
- matchUpFilters: { matchUpTypes: [TEAM$1] },
53023
- structure,
53024
- })?.matchUps ?? [];
53025
- }
53026
- else if (drawDefinition) {
53027
- matchUps =
53028
- allDrawMatchUps({
53029
- matchUpFilters: { matchUpTypes: [TEAM$1] },
53030
- drawDefinition,
53031
- })?.matchUps ?? [];
53032
- }
53033
- const targetMatchUps = matchUps.filter((matchUp) => !matchUp.winningSide &&
53034
- matchUp.matchUpStatus !== COMPLETED$1 &&
53035
- (updateInProgressMatchUps || (matchUp.matchUpStatus !== IN_PROGRESS$1 && !checkScoreHasValue(matchUp))));
53036
- return { targetMatchUps };
53037
- }
53038
-
53039
53045
  function collectionGroupUpdate({ updateInProgressMatchUps, originalValueGoal, tournamentRecord, wasAggregateValue, tieFormatName, drawDefinition, structureId, structure, tieFormat, matchUpId, matchUp, eventId, event, }) {
53040
53046
  const { aggregateValue, valueGoal } = calculateWinCriteria(tieFormat);
53041
53047
  tieFormat.winCriteria = definedAttributes({ aggregateValue, valueGoal });