tods-competition-factory 1.8.37 → 1.8.39

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.
package/dist/index.mjs CHANGED
@@ -2404,7 +2404,7 @@ const matchUpFormatCode = {
2404
2404
  };
2405
2405
 
2406
2406
  function factoryVersion() {
2407
- return "1.8.37";
2407
+ return "1.8.39";
2408
2408
  }
2409
2409
 
2410
2410
  function getObjectTieFormat(obj) {
@@ -20760,6 +20760,8 @@ function getDrawDefinition$1({
20760
20760
  }
20761
20761
 
20762
20762
  function bulkScheduleMatchUps$1({
20763
+ scheduleCompletedMatchUps = false,
20764
+ scheduleByeMatchUps = false,
20763
20765
  errorOnAnachronism = false,
20764
20766
  checkChronology = true,
20765
20767
  matchUpDependencies,
@@ -20789,11 +20791,13 @@ function bulkScheduleMatchUps$1({
20789
20791
  })?.matchUps ?? [];
20790
20792
  }
20791
20793
  const drawIdMap = inContextMatchUps.reduce((drawIdMap2, matchUp) => {
20792
- const { matchUpId, drawId } = matchUp;
20793
- if (drawIdMap2[drawId]) {
20794
- drawIdMap2[drawId].push(matchUpId);
20795
- } else {
20796
- drawIdMap2[drawId] = [matchUpId];
20794
+ const { matchUpId, drawId, matchUpStatus } = matchUp;
20795
+ if ((scheduleByeMatchUps || matchUpStatus !== BYE) && (scheduleCompletedMatchUps || !completedMatchUpStatuses.includes(matchUpStatus))) {
20796
+ if (drawIdMap2[drawId]) {
20797
+ drawIdMap2[drawId].push(matchUpId);
20798
+ } else {
20799
+ drawIdMap2[drawId] = [matchUpId];
20800
+ }
20797
20801
  }
20798
20802
  return drawIdMap2;
20799
20803
  }, {});
@@ -20838,6 +20842,8 @@ function bulkScheduleMatchUps$1({
20838
20842
  }
20839
20843
 
20840
20844
  function bulkScheduleMatchUps({
20845
+ scheduleCompletedMatchUps = false,
20846
+ scheduleByeMatchUps = false,
20841
20847
  errorOnAnachronism,
20842
20848
  matchUpContextIds,
20843
20849
  tournamentRecords,
@@ -20865,6 +20871,8 @@ function bulkScheduleMatchUps({
20865
20871
  if (matchUpIds?.length || tournamentMatchUpDetails?.length) {
20866
20872
  const result = bulkScheduleMatchUps$1({
20867
20873
  matchUpDetails: tournamentMatchUpDetails,
20874
+ scheduleCompletedMatchUps,
20875
+ scheduleByeMatchUps,
20868
20876
  matchUpDependencies,
20869
20877
  errorOnAnachronism,
20870
20878
  tournamentRecords,
@@ -27156,7 +27164,7 @@ function getEventSeedAssignments({
27156
27164
  }
27157
27165
 
27158
27166
  function processEventEntry({
27159
- extensionConversions,
27167
+ convertExtensions,
27160
27168
  seedAssignments,
27161
27169
  participant,
27162
27170
  withSeeding,
@@ -27166,10 +27174,8 @@ function processEventEntry({
27166
27174
  entry
27167
27175
  }) {
27168
27176
  const { entryStatus, entryStage, entryPosition, extensions } = entry;
27169
- const entryExtensions = extensions?.length ? Object.assign({}, ...extensionsToAttributes(extensions)) : {};
27177
+ const entryExtensions = extensions?.length && convertExtensions ? Object.assign({}, ...extensionsToAttributes(extensions)) : {};
27170
27178
  const attributes = Object.assign(entryExtensions, {
27171
- ...extensionConversions,
27172
- // this should be deprecated and clients should use derivedEventInfo
27173
27179
  entryPosition,
27174
27180
  entryStatus,
27175
27181
  entryStage,
@@ -27635,7 +27641,7 @@ function getParticipantEntries(params) {
27635
27641
  return;
27636
27642
  const participant = participantMap[id];
27637
27643
  processEventEntry({
27638
- extensionConversions,
27644
+ convertExtensions,
27639
27645
  seedAssignments,
27640
27646
  participant,
27641
27647
  withSeeding,
@@ -32554,10 +32560,14 @@ function processAlreadyScheduledMatchUps({
32554
32560
  minutesMap,
32555
32561
  matchUps
32556
32562
  }) {
32563
+ const byeScheduledMatchUpIds = [];
32557
32564
  if (!dateScheduledMatchUpIds) {
32558
32565
  dateScheduledMatchUps = matchUps?.filter((matchUp) => {
32559
32566
  const schedule = matchUp.schedule || {};
32560
- return hasSchedule({ schedule }) && (!scheduleDate || matchUp.schedule.scheduledDate === scheduleDate);
32567
+ const isByeMatchUp = matchUp.matchUpStatus === BYE;
32568
+ if (isByeMatchUp)
32569
+ byeScheduledMatchUpIds.push(matchUp.matchUpId);
32570
+ return !isByeMatchUp && hasSchedule({ schedule }) && (!scheduleDate || matchUp.schedule.scheduledDate === scheduleDate);
32561
32571
  });
32562
32572
  dateScheduledMatchUpIds = dateScheduledMatchUps.map(getMatchUpId);
32563
32573
  }
@@ -32589,7 +32599,12 @@ function processAlreadyScheduledMatchUps({
32589
32599
  });
32590
32600
  }
32591
32601
  }
32592
- return { clearDate, dateScheduledMatchUpIds, dateScheduledMatchUps };
32602
+ return {
32603
+ dateScheduledMatchUpIds,
32604
+ byeScheduledMatchUpIds,
32605
+ dateScheduledMatchUps,
32606
+ clearDate
32607
+ };
32593
32608
  }
32594
32609
 
32595
32610
  function getGroupedRounds({
@@ -32727,7 +32742,7 @@ function generateBookings({
32727
32742
  });
32728
32743
  }
32729
32744
  const relevantMatchUps = dateScheduledMatchUps?.filter(
32730
- (matchUp) => !venueIds.length || venueIds.includes(matchUp.schedule.venueId)
32745
+ (matchUp) => (!venueIds.length || venueIds.includes(matchUp.schedule.venueId)) && matchUp.matchUpStatus !== BYE
32731
32746
  );
32732
32747
  const bookings = relevantMatchUps?.map(({ eventId, schedule, matchUpFormat }) => {
32733
32748
  const { event, scheduleTiming } = eventDetails[eventId];
@@ -32844,6 +32859,7 @@ function getVenueSchedulingDetails({
32844
32859
  }) {
32845
32860
  const venueScheduledRoundDetails = {};
32846
32861
  const allDateScheduledMatchUpIds = [];
32862
+ const allDateScheduledByeMatchUpIds = [];
32847
32863
  const allDateMatchUpIds = [];
32848
32864
  for (const venue of venues) {
32849
32865
  const { rounds = [], venueId } = venue;
@@ -32893,8 +32909,10 @@ function getVenueSchedulingDetails({
32893
32909
  minutesMap,
32894
32910
  matchUps
32895
32911
  });
32896
- const clearDate = processResult.clearDate;
32897
32912
  ({ dateScheduledMatchUpIds, dateScheduledMatchUps } = processResult);
32913
+ const { byeScheduledMatchUpIds, clearDate } = processResult;
32914
+ if (byeScheduledMatchUpIds?.length)
32915
+ allDateScheduledByeMatchUpIds.push(...byeScheduledMatchUpIds);
32898
32916
  const { matchUpsToSchedule, matchUpMap } = getMatchUpsToSchedule({
32899
32917
  matchUpPotentialParticipantIds,
32900
32918
  scheduleCompletedMatchUps,
@@ -32925,6 +32943,7 @@ function getVenueSchedulingDetails({
32925
32943
  }
32926
32944
  }
32927
32945
  return {
32946
+ allDateScheduledByeMatchUpIds,
32928
32947
  allDateScheduledMatchUpIds,
32929
32948
  venueScheduledRoundDetails,
32930
32949
  allDateMatchUpIds
@@ -33500,6 +33519,7 @@ function proScheduler({
33500
33519
  }
33501
33520
  });
33502
33521
  const {
33522
+ allDateScheduledByeMatchUpIds,
33503
33523
  allDateScheduledMatchUpIds,
33504
33524
  venueScheduledRoundDetails,
33505
33525
  allDateMatchUpIds
@@ -33781,6 +33801,7 @@ function proScheduler({
33781
33801
  getMatchUpId
33782
33802
  );
33783
33803
  }
33804
+ if (!dryRun && allDateScheduledByeMatchUpIds?.length) ;
33784
33805
  for (const venue of dateSchedulingProfile.venues) {
33785
33806
  for (const round of venue.rounds) {
33786
33807
  const matchUpIds = (round.matchUps ?? []).map(
@@ -34965,7 +34986,7 @@ function getRoundProfile(matchUps) {
34965
34986
  ({ winningSide, matchUpStatus }) => winningSide || completedMatchUpStatuses.includes(matchUpStatus)
34966
34987
  ).length || 0;
34967
34988
  const scheduledCount = matchUps.filter(
34968
- ({ schedule }) => schedule?.scheduledDate && schedule?.scheduledTime
34989
+ ({ schedule, matchUpStatus }) => schedule?.scheduledDate && schedule?.scheduledTime && matchUpStatus !== BYE
34969
34990
  ).length || 0;
34970
34991
  const consideredCount = matchUpsCount - byeCount;
34971
34992
  const isComplete = consideredCount === completedCount;
@@ -59420,7 +59441,11 @@ function generateDrawDefinition(params) {
59420
59441
  tournamentRecord,
59421
59442
  event
59422
59443
  }).appliedPolicies ?? {};
59423
- const policyDefinitions = params.policyDefinitions ?? {};
59444
+ const policyDefinitions = makeDeepCopy(
59445
+ params.policyDefinitions ?? {},
59446
+ false,
59447
+ true
59448
+ );
59424
59449
  const drawTypeCoercion = params.drawTypeCoercion ?? policyDefinitions?.[POLICY_TYPE_DRAWS]?.drawTypeCoercion ?? appliedPolicies?.[POLICY_TYPE_DRAWS]?.drawTypeCoercion ?? true;
59425
59450
  const drawType = drawTypeCoercion && params.drawSize === 2 && DrawTypeEnum.SingleElimination || params.drawType || DrawTypeEnum.SingleElimination;
59426
59451
  const seedingPolicy = policyDefinitions?.[POLICY_TYPE_SEEDING] ?? appliedPolicies?.[POLICY_TYPE_SEEDING];