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.
@@ -13453,8 +13453,9 @@ function getTargetMatchUps({
13453
13453
  return { drawPositions, matchUps, targetMatchUps };
13454
13454
  }
13455
13455
 
13456
- function cleanupLineUps({
13456
+ function resetLineUps({
13457
13457
  inContextDrawMatchUps,
13458
+ inheritance = true,
13458
13459
  tournamentRecord,
13459
13460
  drawDefinition,
13460
13461
  matchUpsMap,
@@ -13462,6 +13463,8 @@ function cleanupLineUps({
13462
13463
  structure,
13463
13464
  event
13464
13465
  }) {
13466
+ if (!drawDefinition)
13467
+ return { error: MISSING_DRAW_DEFINITION };
13465
13468
  const { drawPositions, matchUps, targetMatchUps } = getTargetMatchUps({
13466
13469
  inContextDrawMatchUps,
13467
13470
  matchUpsMap,
@@ -13477,10 +13480,14 @@ function cleanupLineUps({
13477
13480
  ({ matchUpId }) => matchUpId === inContextMatchUp.matchUpId
13478
13481
  );
13479
13482
  if (matchUp?.sides?.[sideIndex]) {
13480
- delete matchUp?.sides[sideIndex].lineUp;
13483
+ if (inheritance) {
13484
+ delete matchUp.sides[sideIndex].lineUp;
13485
+ } else {
13486
+ matchUp.sides[sideIndex].lineUp = [];
13487
+ }
13481
13488
  modifyMatchUpNotice({
13482
13489
  tournamentId: tournamentRecord?.tournamentId,
13483
- context: "cleanupLineUps",
13490
+ context: "resetLineUps",
13484
13491
  eventId: event?.eventId,
13485
13492
  drawDefinition,
13486
13493
  matchUp
@@ -13600,7 +13607,7 @@ function assignDrawPosition({
13600
13607
  if (drawPositionIsActive) {
13601
13608
  return decorateResult({ result: { error: DRAW_POSITION_ACTIVE }, stack });
13602
13609
  }
13603
- cleanupLineUps({
13610
+ resetLineUps({
13604
13611
  assignments: [positionAssignment],
13605
13612
  inContextDrawMatchUps,
13606
13613
  tournamentRecord,