tods-competition-factory 1.6.17 → 1.6.19

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.
@@ -11431,8 +11431,9 @@ function consolationCleanup({
11431
11431
  return { ...SUCCESS };
11432
11432
  }
11433
11433
 
11434
- function cleanupLineUps({
11434
+ function resetLineUps({
11435
11435
  inContextDrawMatchUps,
11436
+ inheritance = true,
11436
11437
  tournamentRecord,
11437
11438
  drawDefinition,
11438
11439
  matchUpsMap,
@@ -11440,6 +11441,8 @@ function cleanupLineUps({
11440
11441
  structure,
11441
11442
  event
11442
11443
  }) {
11444
+ if (!drawDefinition)
11445
+ return { error: MISSING_DRAW_DEFINITION };
11443
11446
  const { drawPositions, matchUps, targetMatchUps } = getTargetMatchUps({
11444
11447
  inContextDrawMatchUps,
11445
11448
  matchUpsMap,
@@ -11455,10 +11458,14 @@ function cleanupLineUps({
11455
11458
  ({ matchUpId }) => matchUpId === inContextMatchUp.matchUpId
11456
11459
  );
11457
11460
  if (matchUp?.sides?.[sideIndex]) {
11458
- delete matchUp?.sides[sideIndex].lineUp;
11461
+ if (inheritance) {
11462
+ delete matchUp.sides[sideIndex].lineUp;
11463
+ } else {
11464
+ matchUp.sides[sideIndex].lineUp = [];
11465
+ }
11459
11466
  modifyMatchUpNotice({
11460
11467
  tournamentId: tournamentRecord?.tournamentId,
11461
- context: "cleanupLineUps",
11468
+ context: "resetLineUps",
11462
11469
  eventId: event?.eventId,
11463
11470
  drawDefinition,
11464
11471
  matchUp
@@ -11578,7 +11585,7 @@ function assignDrawPosition({
11578
11585
  if (drawPositionIsActive) {
11579
11586
  return decorateResult({ result: { error: DRAW_POSITION_ACTIVE }, stack });
11580
11587
  }
11581
- cleanupLineUps({
11588
+ resetLineUps({
11582
11589
  assignments: [positionAssignment],
11583
11590
  inContextDrawMatchUps,
11584
11591
  tournamentRecord,