tods-competition-factory 0.70.3 → 0.71.0

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.
@@ -249,7 +249,7 @@ const matchUpFormatCode = {
249
249
  };
250
250
 
251
251
  function factoryVersion() {
252
- return '0.70.3';
252
+ return '0.71.0';
253
253
  }
254
254
 
255
255
  const FORMAT_STANDARD = 'SET3-S:6/TB7'; // Best of 3 Tiebreak Sets to 6
@@ -11560,6 +11560,8 @@ function getAllStructureMatchUps({
11560
11560
 
11561
11561
  if (tournamentParticipants && matchUpWithContext.sides) {
11562
11562
  matchUpWithContext.sides.filter(Boolean).forEach(side => {
11563
+ var _side$participant;
11564
+
11563
11565
  if (side.participantId) {
11564
11566
  const participant = findParticipant({
11565
11567
  policyDefinitions: appliedPolicies,
@@ -11574,7 +11576,7 @@ function getAllStructureMatchUps({
11574
11576
  }
11575
11577
  }
11576
11578
 
11577
- if (side.participant && side.participant.individualParticipantIds) {
11579
+ if (side !== null && side !== void 0 && (_side$participant = side.participant) !== null && _side$participant !== void 0 && _side$participant.individualParticipantIds) {
11578
11580
  const individualParticipants = side.participant.individualParticipantIds.map(participantId => {
11579
11581
  return findParticipant({
11580
11582
  policyDefinitions: appliedPolicies,
@@ -22316,7 +22318,7 @@ function addParticipantContext(params) {
22316
22318
  var _participant$individu;
22317
22319
 
22318
22320
  const groupParticipantId = participant.participantId;
22319
- (_participant$individu = participant.individualParticipantIds) === null || _participant$individu === void 0 ? void 0 : _participant$individu.forEach(participantId => {
22321
+ participant === null || participant === void 0 ? void 0 : (_participant$individu = participant.individualParticipantIds) === null || _participant$individu === void 0 ? void 0 : _participant$individu.forEach(participantId => {
22320
22322
  if (!participantIdMap[participantId].groupParticipantIds.includes(groupParticipantId)) {
22321
22323
  participantIdMap[participantId].groupParticipantIds.push(groupParticipantId);
22322
22324
  participantIdMap[participantId].groups.push({
@@ -22333,7 +22335,7 @@ function addParticipantContext(params) {
22333
22335
  var _participant$individu2;
22334
22336
 
22335
22337
  const teamParticipantId = participant.participantId;
22336
- (_participant$individu2 = participant.individualParticipantIds) === null || _participant$individu2 === void 0 ? void 0 : _participant$individu2.forEach(participantId => {
22338
+ participant === null || participant === void 0 ? void 0 : (_participant$individu2 = participant.individualParticipantIds) === null || _participant$individu2 === void 0 ? void 0 : _participant$individu2.forEach(participantId => {
22337
22339
  if (!participantIdMap[participantId].teamParticipantIds.includes(teamParticipantId)) {
22338
22340
  participantIdMap[participantId].teamParticipantIds.push(teamParticipantId);
22339
22341
  participantIdMap[participantId].teams.push({
@@ -22351,7 +22353,7 @@ function addParticipantContext(params) {
22351
22353
  var _participant$individu3;
22352
22354
 
22353
22355
  const pairParticipantId = participant.participantId;
22354
- (_participant$individu3 = participant.individualParticipantIds) === null || _participant$individu3 === void 0 ? void 0 : _participant$individu3.forEach(participantId => {
22356
+ participant === null || participant === void 0 ? void 0 : (_participant$individu3 = participant.individualParticipantIds) === null || _participant$individu3 === void 0 ? void 0 : _participant$individu3.forEach(participantId => {
22355
22357
  if (!participantIdMap[participantId].pairParticipantIds.includes(pairParticipantId)) {
22356
22358
  participantIdMap[participantId].pairParticipantIds.push(pairParticipantId);
22357
22359
  }
@@ -36033,14 +36035,14 @@ function addEventEntries(params) {
36033
36035
  var _tournamentRecord$par;
36034
36036
 
36035
36037
  const {
36038
+ entryStatus = DIRECT_ACCEPTANCE,
36039
+ autoEntryPositions = true,
36040
+ participantIds = [],
36041
+ entryStage = MAIN,
36036
36042
  tournamentRecord,
36037
36043
  drawDefinition,
36038
36044
  drawId,
36039
- event,
36040
- participantIds = [],
36041
- entryStatus = DIRECT_ACCEPTANCE,
36042
- entryStage = MAIN,
36043
- autoEntryPositions = true
36045
+ event
36044
36046
  } = params;
36045
36047
  if (!event) return {
36046
36048
  error: MISSING_EVENT
@@ -36068,7 +36070,7 @@ function addEventEntries(params) {
36068
36070
  return true;
36069
36071
  }
36070
36072
 
36071
- if (event.eventType === TEAM$1 && participant.participantType === TEAM$1) {
36073
+ if (event.eventType === TEAM$1 && (participant.participantType === TEAM$1 || entryStatus === UNGROUPED && participant.participantType === INDIVIDUAL$1)) {
36072
36074
  return true;
36073
36075
  }
36074
36076
 
@@ -36088,7 +36090,7 @@ function addEventEntries(params) {
36088
36090
  });
36089
36091
  let message;
36090
36092
 
36091
- if (drawId) {
36093
+ if (drawId && ![UNGROUPED, UNPAIRED].includes(entryStatus)) {
36092
36094
  const result = addDrawEntries({
36093
36095
  participantIds: validParticipantIds,
36094
36096
  autoEntryPositions,
@@ -36981,7 +36983,7 @@ function generateDrawMaticRound({
36981
36983
  if (teamParticipants) {
36982
36984
  // add SAME_TEAM_VALUE for participants who appear on the same team
36983
36985
  for (const teamParticipant of teamParticipants) {
36984
- const participantIds = teamParticipant.individualParticipantIds;
36986
+ const participantIds = teamParticipant.individualParticipantIds || [];
36985
36987
  const {
36986
36988
  uniquePairings
36987
36989
  } = getPairingsData({
@@ -40531,6 +40533,44 @@ function addPersons({
40531
40533
  };
40532
40534
  }
40533
40535
 
40536
+ /**
40537
+ * function called internally to cleanup event entries when individuals have been added to team events
40538
+ */
40539
+
40540
+ function updateTeamEventEntries({
40541
+ individualParticipantIds,
40542
+ groupingParticipantId,
40543
+ tournamentRecord
40544
+ }) {
40545
+ const relevantEvents = (tournamentRecord.events || []).filter(event => {
40546
+ var _event$entries;
40547
+
40548
+ return (event === null || event === void 0 ? void 0 : event.eventType) === TEAM$2 && (event === null || event === void 0 ? void 0 : (_event$entries = event.entries) === null || _event$entries === void 0 ? void 0 : _event$entries.some(entry => entry.participantId === groupingParticipantId));
40549
+ });
40550
+
40551
+ const filterEntry = entry => !individualParticipantIds.includes(entry.participantId);
40552
+
40553
+ for (const event of relevantEvents) {
40554
+ var _flightProfile$flight, _event$drawDefinition;
40555
+
40556
+ event.entries = (event.entries || []).filter(filterEntry);
40557
+ const {
40558
+ flightProfile
40559
+ } = getFlightProfile({
40560
+ event
40561
+ });
40562
+ flightProfile === null || flightProfile === void 0 ? void 0 : (_flightProfile$flight = flightProfile.flights) === null || _flightProfile$flight === void 0 ? void 0 : _flightProfile$flight.forEach(flight => {
40563
+ flight.drawEntries = (flight.drawEntries || []).filter(filterEntry);
40564
+ });
40565
+ event === null || event === void 0 ? void 0 : (_event$drawDefinition = event.drawDefinitions) === null || _event$drawDefinition === void 0 ? void 0 : _event$drawDefinition.forEach(drawDefinition => {
40566
+ drawDefinition.entries = (drawDefinition.entries || []).filter(filterEntry);
40567
+ });
40568
+ }
40569
+
40570
+ return { ...SUCCESS
40571
+ };
40572
+ }
40573
+
40534
40574
  /**
40535
40575
  *
40536
40576
  * @param {object} tournamentRecord - passed in automatically by tournamentEngine
@@ -40541,10 +40581,10 @@ function addPersons({
40541
40581
  */
40542
40582
 
40543
40583
  function addIndividualParticipantIds({
40544
- tournamentRecord,
40545
- groupingParticipantId,
40546
40584
  individualParticipantIds,
40547
- removeFromOtherTeams
40585
+ groupingParticipantId,
40586
+ removeFromOtherTeams,
40587
+ tournamentRecord
40548
40588
  }) {
40549
40589
  if (!tournamentRecord) return {
40550
40590
  error: MISSING_TOURNAMENT_RECORD
@@ -40608,9 +40648,15 @@ function addIndividualParticipantIds({
40608
40648
  });
40609
40649
  }
40610
40650
 
40611
- return { ...SUCCESS,
40651
+ updateTeamEventEntries({
40652
+ individualParticipantIds,
40653
+ groupingParticipantId,
40654
+ tournamentRecord
40655
+ });
40656
+ return {
40612
40657
  groupingParticipant: makeDeepCopy(groupingParticipant),
40613
- added: participantIdsToAdd.length
40658
+ added: participantIdsToAdd.length,
40659
+ ...SUCCESS
40614
40660
  };
40615
40661
  }
40616
40662