tods-competition-factory 1.6.10 → 1.6.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.
@@ -4563,7 +4563,7 @@ function structureSort(a, b, config) {
4563
4563
  const completedStructure = (s) => s?.matchUps.every(
4564
4564
  ({ matchUpStatus }) => completedMatchUpStatuses.includes(matchUpStatus) ? 1 : -1
4565
4565
  );
4566
- return completed && completedStructure(a) - completedStructure(b) || aggregate && protocolSequence(a) - protocolSequence(b) || (a?.stage && orderProtocol[a.stage] || 0) - (b?.stage && orderProtocol[b.stage] || 0) || (getRoundTarget(a) || 0) - (getRoundTarget(b) || 0) || !finish && !aggregate && (b?.positionAssignments?.length || Infinity) - (a?.positionAssignments?.length || Infinity) || (a?.stageSequence || 0) - (b?.stageSequence || 0) || (getMinFinishingPositionRange(a) || 0) - (getMinFinishingPositionRange(b) || 0);
4566
+ return completed && completedStructure(a) - completedStructure(b) || aggregate && protocolSequence(a) - protocolSequence(b) || (a?.stage && orderProtocol[a.stage] || 0) - (b?.stage && orderProtocol[b.stage] || 0) || (getRoundTarget(a) || 0) - (getRoundTarget(b) || 0) || !finish && !aggregate && (b?.positionAssignments?.length ?? Infinity) - (a?.positionAssignments?.length ?? Infinity) || (a?.stageSequence ?? 0) - (b?.stageSequence ?? 0) || (getMinFinishingPositionRange(a) || 0) - (getMinFinishingPositionRange(b) || 0);
4567
4567
  }
4568
4568
  function getMinFinishingPositionRange(structure) {
4569
4569
  return (structure?.matchUps || []).reduce((rangeSum, matchUp) => {
@@ -4653,6 +4653,7 @@ EntryStatusEnum.Withdrawn;
4653
4653
 
4654
4654
  function getStageEntries({
4655
4655
  provisionalPositioning,
4656
+ placementGroup,
4656
4657
  drawDefinition,
4657
4658
  stageSequence,
4658
4659
  entryStatuses,
@@ -4682,7 +4683,9 @@ function getStageEntries({
4682
4683
  if (error) {
4683
4684
  console.log("playoff entries error");
4684
4685
  }
4685
- return playoffEntries?.length ? playoffEntries : entries;
4686
+ return (playoffEntries?.length ? playoffEntries : entries).filter(
4687
+ (entry) => !placementGroup || entry.placementGroup === placementGroup
4688
+ );
4686
4689
  }
4687
4690
  return entries;
4688
4691
  }