tods-competition-factory 2.1.18 → 2.1.20

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.1.18';
6
+ return '2.1.20';
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';
@@ -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,
@@ -45041,18 +45049,20 @@ function setMatchUpState(params) {
45041
45049
  });
45042
45050
  const existingDualMatchUpWinningSide = dualMatchUp.winningSide;
45043
45051
  dualWinningSideChange = projectedWinningSide !== existingDualMatchUpWinningSide;
45052
+ const autoCalcDisabled = dualMatchUp._disableAutoCalc;
45044
45053
  Object.assign(params, {
45045
45054
  isCollectionMatchUp: true,
45046
45055
  dualWinningSideChange,
45047
45056
  projectedWinningSide,
45057
+ autoCalcDisabled,
45048
45058
  matchUpTieId,
45049
45059
  dualMatchUp,
45050
45060
  tieFormat,
45051
45061
  });
45052
45062
  }
45053
45063
  }
45054
- const activeDownstream = isActiveDownstream(params);
45055
45064
  const directingMatchUpStatus = isDirectingMatchUpStatus({ matchUpStatus });
45065
+ const activeDownstream = isActiveDownstream(params);
45056
45066
  if (!matchUpTieId) {
45057
45067
  if (activeDownstream &&
45058
45068
  !winningSide &&
@@ -45100,7 +45110,7 @@ function setMatchUpState(params) {
45100
45110
  method: stack,
45101
45111
  winningSide,
45102
45112
  });
45103
- const result = (!activeDownstream && noDownstreamDependencies(params)) ||
45113
+ const result = ((!activeDownstream || params.autoCalcDisabled) && noDownstreamDependencies(params)) ||
45104
45114
  (matchUpWinner && winningSideWithDownstreamDependencies(params)) ||
45105
45115
  (directingMatchUpStatus && applyMatchUpValues(params)) || {
45106
45116
  error: NO_VALID_ACTIONS,