function addDrawPositionToMatchUps({
  inContextDrawMatchUps,
  automaticPlacement,
  tournamentRecord,
  drawDefinition,
  drawPosition,
  matchUpsMap,
  structure,
  event,
}) {
  const matchUpFilters = { isCollectionMatchUp: false };
  const { matchUps } = getAllStructureMatchUps({
    inContextDrawMatchUps,
    drawDefinition,
    matchUpFilters,
    matchUpsMap,
    structure,
    event,
  });

  const { roundMatchUps } = getRoundMatchUps({ matchUps });
  const { initialRoundNumber } = getInitialRoundNumber({
    drawPosition,
    matchUps,
  });

  const matchUp = roundMatchUps[initialRoundNumber].find((matchUp) =>
    matchUp.drawPositions?.includes(drawPosition)
  );

  if (matchUp) {
    const result = assignMatchUpDrawPosition({
      matchUpId: matchUp.matchUpId,
      inContextDrawMatchUps,
      automaticPlacement,
      tournamentRecord,
      drawDefinition,
      drawPosition,
      matchUpsMap,
    });
    if (result.error)
      return decorateResult({
        stack: 'assignDrawPositionToMatchUps',
        context: { drawPosition },
        result,
      });
  }
}
// used for matchUps which are NOT in a ROUND_ROBIN { structureType: CONTAINER }
used for matchUps which are NOT in a ROUND_ROBIN { structureType: CONTAINER }
used for matchUps which are NOT in a ROUND_ROBIN { structureType : CONTAINER }
function addDrawPositionToMatchUps({
  inContextDrawMatchUps,
  automaticPlacement,
  tournamentRecord,
  drawDefinition,
  drawPosition,
  matchUpsMap,
  structure,
  event,
}) {
  const matchUpFilters = { isCollectionMatchUp: false };
  const { matchUps } = getAllStructureMatchUps({
    inContextDrawMatchUps,
    drawDefinition,
    matchUpFilters,
    matchUpsMap,
    structure,
    event,
  });
  const { roundMatchUps } = getRoundMatchUps({ matchUps });
  const { initialRoundNumber } = getInitialRoundNumber({
    drawPosition,
    matchUps,
  });
  const matchUp = roundMatchUps[initialRoundNumber].find((matchUp) =>
    matchUp.drawPositions?.includes(drawPosition)
  );
  if (matchUp) {
    const result = assignMatchUpDrawPosition({
      matchUpId: matchUp.matchUpId,
      inContextDrawMatchUps,
      automaticPlacement,
      tournamentRecord,
      drawDefinition,
      drawPosition,
      matchUpsMap,
    });
    if (result.error)
      return decorateResult({
        stack: 'assignDrawPositionToMatchUps',
        context: { drawPosition },
        result,
      });
  }
}
function addDrawPositionToMatchUps ( { inContextDrawMatchUps , automaticPlacement , tournamentRecord , drawDefinition , drawPosition , matchUpsMap , structure , event , } ) { const matchUpFilters = { isCollectionMatchUp : false } ; const { matchUps } = getAllStructureMatchUps ( { inContextDrawMatchUps , drawDefinition , matchUpFilters , matchUpsMap , structure , event , } ) ; const { roundMatchUps } = getRoundMatchUps ( { matchUps } ) ; const { initialRoundNumber } = getInitialRoundNumber ( { drawPosition , matchUps , } ) ; const matchUp = roundMatchUps [ initialRoundNumber ] . find ( ( matchUp ) => matchUp . drawPositions ?. includes ( drawPosition ) ) ; if ( matchUp ) { const result = assignMatchUpDrawPosition ( { matchUpId : matchUp . matchUpId , inContextDrawMatchUps , automaticPlacement , tournamentRecord , drawDefinition , drawPosition , matchUpsMap , } ) ; if ( result . error ) return decorateResult ( { stack : 'assignDrawPositionToMatchUps' , context : { drawPosition } , result , } ) ; } }
used for matchUps which are NOT in a ROUND_ROBIN { structureType: CONTAINER }
used for matchUps which are NOT in a ROUND_ROBIN { structureType : CONTAINER }