tods-competition-factory 1.8.25 → 1.8.27

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.
@@ -1726,7 +1726,7 @@ type GetPositionAssignmentsArgs = {
1726
1726
  structure?: any;
1727
1727
  };
1728
1728
  declare function getPositionAssignments({ drawDefinition, structureId, structure, }: GetPositionAssignmentsArgs): {
1729
- positionAssignments?: PositionAssignment[];
1729
+ positionAssignments: PositionAssignment[];
1730
1730
  error?: ErrorType;
1731
1731
  };
1732
1732
 
@@ -392,18 +392,21 @@ function cycleMutationStatus() {
392
392
  return status;
393
393
  }
394
394
  function addNotice$1({ topic, payload, key }) {
395
- syncGlobalState.modified = true;
396
395
  if (typeof topic !== "string" || typeof payload !== "object") {
397
396
  return;
398
397
  }
399
- if (syncGlobalState.disableNotifications || !syncGlobalState.subscriptions[topic])
398
+ if (!syncGlobalState.disableNotifications)
399
+ syncGlobalState.modified = true;
400
+ if (syncGlobalState.disableNotifications || !syncGlobalState.subscriptions[topic]) {
400
401
  return;
402
+ }
401
403
  if (key) {
402
404
  syncGlobalState.notices = syncGlobalState.notices.filter(
403
405
  (notice) => !(notice.topic === topic && notice.key === key)
404
406
  );
405
407
  }
406
408
  syncGlobalState.notices.push({ topic, payload, key });
409
+ return { ...SUCCESS };
407
410
  }
408
411
  function getNotices({ topic }) {
409
412
  const notices = syncGlobalState.notices.filter((notice) => notice.topic === topic).map((notice) => notice.payload);
@@ -1280,6 +1283,7 @@ const WINNER = "WINNER";
1280
1283
  const LOSER = "LOSER";
1281
1284
  const FIRST_MATCHUP = "FIRST_MATCHUP";
1282
1285
  const AD_HOC = "AD_HOC";
1286
+ const FLEX_ROUNDS = "AD_HOC";
1283
1287
  const FEED_IN$1 = "FEED_IN";
1284
1288
  const COMPASS = "COMPASS";
1285
1289
  const OLYMPIC = "OLYMPIC";
@@ -1370,6 +1374,7 @@ const drawDefinitionConstants = {
1370
1374
  LOSER,
1371
1375
  AD_HOC,
1372
1376
  FEED_IN: FEED_IN$1,
1377
+ FLEX_ROUNDS,
1373
1378
  COMPASS,
1374
1379
  PLAY_OFF,
1375
1380
  OLYMPIC,
@@ -6211,6 +6216,7 @@ function getMatchUpType(params) {
6211
6216
 
6212
6217
  function getStructureSeedAssignments({
6213
6218
  provisionalPositioning,
6219
+ returnAllProxies,
6214
6220
  drawDefinition,
6215
6221
  structureId,
6216
6222
  structure
@@ -6219,6 +6225,9 @@ function getStructureSeedAssignments({
6219
6225
  if (!structure) {
6220
6226
  ({ structure, error } = findStructure({ drawDefinition, structureId }));
6221
6227
  }
6228
+ const positionAssignments = getPositionAssignments({
6229
+ structure
6230
+ }).positionAssignments;
6222
6231
  if (error || !structure)
6223
6232
  return { seedAssignments: [], error: STRUCTURE_NOT_FOUND };
6224
6233
  if (!structureId)
@@ -6232,18 +6241,22 @@ function getStructureSeedAssignments({
6232
6241
  structureId,
6233
6242
  stage
6234
6243
  });
6235
- const seedProxies = entries ? entries.filter((entry) => entry.placementGroup === 1).sort((a, b) => {
6244
+ const proxiedEntries = entries ? entries.filter((entry) => entry.placementGroup === 1).sort((a, b) => {
6236
6245
  return a.GEMscore < b.GEMscore && 1 || a.GEMscore > b.GEMscore && -1 || 0;
6237
6246
  }).map((entry, index) => {
6238
6247
  const seedNumber = index + 1;
6239
6248
  return {
6240
6249
  participantId: entry.participantId,
6241
6250
  seedValue: seedNumber,
6242
- seedNumber,
6243
- seedProxy: true
6251
+ seedProxy: true,
6244
6252
  // flag so that proxy seeding information doesn't get used externally
6253
+ seedNumber
6245
6254
  };
6246
6255
  }) : [];
6256
+ const seedProxies = proxiedEntries?.slice(
6257
+ 0,
6258
+ returnAllProxies ? proxiedEntries.length : positionAssignments.length / 2
6259
+ );
6247
6260
  if (seedProxies.length) {
6248
6261
  seedAssignments = seedProxies;
6249
6262
  } else if (structure.seedAssignments) {
@@ -6252,7 +6265,13 @@ function getStructureSeedAssignments({
6252
6265
  error = MISSING_SEED_ASSIGNMENTS;
6253
6266
  }
6254
6267
  const seedLimit = structure.seedLimit || structure?.positionAssignments?.length;
6255
- return { seedAssignments, seedLimit, stage, stageSequence, error };
6268
+ return {
6269
+ seedAssignments,
6270
+ stageSequence,
6271
+ seedLimit,
6272
+ stage,
6273
+ error
6274
+ };
6256
6275
  }
6257
6276
 
6258
6277
  function getRangeString(arr) {
@@ -13499,6 +13518,7 @@ function getSeedGroups({
13499
13518
 
13500
13519
  function getValidSeedBlocks({
13501
13520
  provisionalPositioning,
13521
+ returnAllProxies,
13502
13522
  appliedPolicies,
13503
13523
  drawDefinition,
13504
13524
  allPositions,
@@ -13514,6 +13534,7 @@ function getValidSeedBlocks({
13514
13534
  });
13515
13535
  const { seedAssignments } = getStructureSeedAssignments({
13516
13536
  provisionalPositioning,
13537
+ returnAllProxies,
13517
13538
  drawDefinition,
13518
13539
  structure
13519
13540
  });
@@ -13748,6 +13769,7 @@ function getNextSeedBlock(params) {
13748
13769
  } = params;
13749
13770
  const { structure } = findStructure({ drawDefinition, structureId });
13750
13771
  const { seedAssignments } = getStructureSeedAssignments({
13772
+ returnAllProxies: params.returnAllProxies,
13751
13773
  provisionalPositioning,
13752
13774
  drawDefinition,
13753
13775
  structure
@@ -13759,6 +13781,7 @@ function getNextSeedBlock(params) {
13759
13781
  const assignedDrawPositions = positionsWithParticipants?.map((assignment) => assignment.drawPosition).filter(Boolean);
13760
13782
  const { appliedPolicies } = getAppliedPolicies({ drawDefinition });
13761
13783
  const validSeedBlocks = seedBlockInfo?.validSeedBlocks || structure && getValidSeedBlocks({
13784
+ returnAllProxies: params.returnAllProxies,
13762
13785
  provisionalPositioning,
13763
13786
  appliedPolicies,
13764
13787
  drawDefinition,
@@ -13867,6 +13890,7 @@ function getValidAssignmentActions({
13867
13890
  if (!ignoreSeedPositions) {
13868
13891
  const result = getNextSeedBlock({
13869
13892
  provisionalPositioning,
13893
+ returnAllProxies: true,
13870
13894
  randomize: true,
13871
13895
  drawDefinition,
13872
13896
  structureId,
@@ -14392,6 +14416,7 @@ function positionActions$1(params) {
14392
14416
  action: SEED_VALUE
14393
14417
  }) && isAvailableAction({ policyActions, action: SEED_VALUE }) && isValidSeedPosition({ drawDefinition, structureId, drawPosition }) && validToAssignSeed) {
14394
14418
  const { seedAssignments } = getStructureSeedAssignments({
14419
+ returnAllProxies: true,
14395
14420
  drawDefinition,
14396
14421
  structure
14397
14422
  });
@@ -14418,6 +14443,7 @@ function positionActions$1(params) {
14418
14443
  action: REMOVE_SEED
14419
14444
  }) && isAvailableAction({ policyActions, action: REMOVE_SEED }) && isValidSeedPosition({ drawDefinition, structureId, drawPosition }) && validToAssignSeed) {
14420
14445
  const { seedAssignments } = getStructureSeedAssignments({
14446
+ returnAllProxies: true,
14421
14447
  drawDefinition,
14422
14448
  structure
14423
14449
  });