tods-competition-factory 2.2.9 → 2.2.11

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.
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  function factoryVersion() {
6
- return '2.2.9';
6
+ return '2.2.11';
7
7
  }
8
8
 
9
9
  const SINGLES_MATCHUP = 'SINGLES';
@@ -36421,6 +36421,11 @@ function scheduledSortedMatchUps({ schedulingProfile, matchUps = [] }) {
36421
36421
  timeGroups[scheduledTime] = [];
36422
36422
  timeGroups[scheduledTime].push(matchUp);
36423
36423
  }
36424
+ for (const timeKey of Object.keys(timeGroups)) {
36425
+ const timeGroup = timeGroups[timeKey];
36426
+ const sortedTimeGroup = timeGroup.sort((a, b) => (a['roundNumber'] || 0) - (b['roundNumber'] || 0));
36427
+ timeGroups[timeKey] = sortedTimeGroup;
36428
+ }
36424
36429
  const sortedTimeKeys = Object.keys(timeGroups).sort();
36425
36430
  for (const scheduledTime of sortedTimeKeys) {
36426
36431
  const timeGroup = timeGroups[scheduledTime];
@@ -55841,7 +55846,7 @@ function removeCollectionGroup({ updateInProgressMatchUps = true, collectionGrou
55841
55846
 
55842
55847
  function getOrderedTieFormat({ tieFormat, orderMap }) {
55843
55848
  const orderedTieFormat = copyTieFormat(tieFormat);
55844
- orderedTieFormat.collectionDefinitions.forEach((collectionDefinition) => {
55849
+ orderedTieFormat.collectionDefinitions?.forEach((collectionDefinition) => {
55845
55850
  const collectionOrder = orderMap[collectionDefinition.collectionId];
55846
55851
  if (collectionOrder)
55847
55852
  collectionDefinition.collectionOrder = collectionOrder;
@@ -55855,6 +55860,10 @@ function orderCollectionDefinitions({ tournamentRecord, drawDefinition, structur
55855
55860
  result: { error: INVALID_VALUES },
55856
55861
  context: { orderMap },
55857
55862
  });
55863
+ const result = structureId ? findStructure({ drawDefinition, structureId }) : undefined;
55864
+ if (result?.error)
55865
+ return result;
55866
+ const structure = result?.structure;
55858
55867
  if (eventId && event?.tieFormat) {
55859
55868
  updateEventTieFormat({ tournamentRecord, event, orderMap });
55860
55869
  }
@@ -55869,24 +55878,19 @@ function orderCollectionDefinitions({ tournamentRecord, drawDefinition, structur
55869
55878
  matchUp = result.matchUp;
55870
55879
  if (!matchUp)
55871
55880
  return { error: MISSING_MATCHUP };
55872
- if (matchUp?.tieFormat) {
55873
- matchUp.tieFormat = getOrderedTieFormat({
55874
- tieFormat: matchUp.tieFormat,
55875
- orderMap,
55876
- });
55877
- modifyMatchUpNotice({
55878
- tournamentId: tournamentRecord?.tournamentId,
55879
- eventId: event?.eventId,
55880
- drawDefinition,
55881
- matchUp,
55882
- });
55883
- }
55881
+ const tieFormat = getTieFormat$1({ tournamentRecord, matchUpId, structure, drawDefinition, event })?.tieFormat;
55882
+ matchUp.tieFormat = getOrderedTieFormat({
55883
+ tieFormat,
55884
+ orderMap,
55885
+ });
55886
+ modifyMatchUpNotice({
55887
+ tournamentId: tournamentRecord?.tournamentId,
55888
+ eventId: event?.eventId,
55889
+ drawDefinition,
55890
+ matchUp,
55891
+ });
55884
55892
  }
55885
55893
  else if (structureId) {
55886
- const result = findStructure({ drawDefinition, structureId });
55887
- if (result.error)
55888
- return result;
55889
- const structure = result.structure;
55890
55894
  if (structure?.tieFormat) {
55891
55895
  structure.tieFormat = getOrderedTieFormat({
55892
55896
  tieFormat: structure.tieFormat,