tods-competition-factory 1.8.20 → 1.8.22

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.
@@ -3354,7 +3354,6 @@ const DIRECT_ENTRY_STATUSES = [
3354
3354
  const STRUCTURE_SELECTED_STATUSES = [
3355
3355
  CONFIRMED,
3356
3356
  DIRECT_ACCEPTANCE,
3357
- FEED_IN,
3358
3357
  JUNIOR_EXEMPT,
3359
3358
  LUCKY_LOSER,
3360
3359
  QUALIFIER,
@@ -4308,6 +4307,9 @@ const POLICY_ROUND_NAMING_DEFAULT = {
4308
4307
  namingConventions: {
4309
4308
  round: "Round"
4310
4309
  },
4310
+ qualifyingFinishMap: {
4311
+ 1: "Final"
4312
+ },
4311
4313
  abbreviatedRoundNamingMap: {
4312
4314
  // key is matchUpsCount for the round
4313
4315
  1: "F",
@@ -4321,7 +4323,8 @@ const POLICY_ROUND_NAMING_DEFAULT = {
4321
4323
  },
4322
4324
  affixes: {
4323
4325
  roundNumber: "R",
4324
- preFeedRound: "Q"
4326
+ preFeedRound: "Q",
4327
+ preQualifying: "P"
4325
4328
  },
4326
4329
  stageConstants: {
4327
4330
  [MAIN]: "",
@@ -4334,6 +4337,7 @@ const POLICY_ROUND_NAMING_DEFAULT = {
4334
4337
 
4335
4338
  function getRoundContextProfile({
4336
4339
  roundNamingPolicy,
4340
+ drawDefinition,
4337
4341
  structure,
4338
4342
  matchUps
4339
4343
  }) {
@@ -4344,21 +4348,31 @@ function getRoundContextProfile({
4344
4348
  const isRoundRobin = structure.structures;
4345
4349
  const roundNamingProfile = {};
4346
4350
  const defaultRoundNamingPolicy = POLICY_ROUND_NAMING_DEFAULT[POLICY_TYPE_ROUND_NAMING];
4351
+ const isQualifying = structure.stage === QUALIFYING;
4352
+ const qualifyingFinishgMap = isQualifying && (roundNamingPolicy?.qualifyingFinishMap || defaultRoundNamingPolicy?.qualifyingFinishMap || {});
4353
+ const qualifyingStageSequences = isQualifying ? Math.max(
4354
+ ...(drawDefinition?.structures ?? []).filter((structure2) => structure2.stage === QUALIFYING).map(({ stageSequence }) => stageSequence ?? 1),
4355
+ 0
4356
+ ) : 0;
4357
+ const preQualifyingSequence = qualifyingStageSequences ? qualifyingStageSequences - (structure.stageSequence || 1) || "" : "";
4358
+ const preQualifyingAffix = preQualifyingSequence ? roundNamingPolicy?.affixes?.preQualifying || defaultRoundNamingPolicy.affixes.preQualifying || "" : "";
4347
4359
  const roundNamingMap = roundNamingPolicy?.roundNamingMap || defaultRoundNamingPolicy.roundNamingMap || {};
4348
4360
  const abbreviatedRoundNamingMap = roundNamingPolicy?.abbreviatedRoundNamingMap || defaultRoundNamingPolicy.abbreviatedRoundNamingMap || {};
4349
- const roundNamePrefix = roundNamingPolicy?.affixes || defaultRoundNamingPolicy.affixes;
4350
- const roundNumberAffix = roundNamePrefix.roundNumber || defaultRoundNamingPolicy.affixes.roundNumber;
4361
+ const preFeedAffix = roundNamingPolicy?.affixes?.preFeedRound || defaultRoundNamingPolicy.affixes.preFeedRound;
4362
+ const roundNumberAffix = roundNamingPolicy?.affixes?.roundNumber || defaultRoundNamingPolicy.affixes.roundNumber;
4351
4363
  const namingConventions = roundNamingPolicy?.namingConventions || defaultRoundNamingPolicy.namingConventions;
4352
4364
  const roundNameFallback = namingConventions.round;
4353
- const stageInitial = stage && stage !== MAIN && stage[0];
4354
- const stageConstants = roundNamingPolicy?.stageConstants;
4355
- const stageConstant = stage && stageConstants?.[stage] || stageInitial;
4365
+ const stageInitial = stage && stage !== MAIN ? stage[0] : "";
4366
+ const stageConstants = roundNamingPolicy?.stageConstants || defaultRoundNamingPolicy.stageConstants;
4367
+ const stageIndicator = stage && stageConstants?.[stage] || stageInitial;
4368
+ const stageConstant = `${preQualifyingAffix}${stageIndicator}${preQualifyingSequence}`;
4356
4369
  const roundProfileKeys = roundProfile ? Object.keys(roundProfile) : [];
4370
+ const qualifyingAffix = isQualifying && stageConstants?.[QUALIFYING] ? `${stageConstants?.[QUALIFYING]}-` : "";
4357
4371
  if (isRoundRobin || isAdHocStructure || isLuckyStructure) {
4358
4372
  Object.assign(
4359
4373
  roundNamingProfile,
4360
4374
  ...roundProfileKeys.map((key) => {
4361
- const roundName = `${roundNameFallback} ${key}`;
4375
+ const roundName = `${qualifyingAffix}${roundNameFallback} ${key}`;
4362
4376
  const abbreviatedRoundName = `${roundNumberAffix}${key}`;
4363
4377
  return { [key]: { roundName, abbreviatedRoundName } };
4364
4378
  })
@@ -4371,15 +4385,15 @@ function getRoundContextProfile({
4371
4385
  return;
4372
4386
  const { matchUpsCount, preFeedRound } = roundProfile[round];
4373
4387
  const participantsCount = matchUpsCount * 2;
4374
- const sizedRoundName = roundNamingMap[matchUpsCount] || `${roundNamePrefix.roundNumber}${participantsCount}`;
4375
- const suffix = preFeedRound ? `-${roundNamePrefix.preFeedRound}` : "";
4388
+ const sizedRoundName = qualifyingFinishgMap?.[roundProfile?.[round].finishingRound] || qualifyingFinishgMap && `${roundNumberAffix}${participantsCount}` || roundNamingMap[matchUpsCount] || `${roundNumberAffix}${participantsCount}`;
4389
+ const suffix = preFeedRound ? `-${preFeedAffix}` : "";
4376
4390
  const profileRoundName = `${sizedRoundName}${suffix}`;
4377
4391
  const roundName = [
4378
4392
  stageConstant,
4379
4393
  structureAbbreviation,
4380
4394
  profileRoundName
4381
4395
  ].filter(Boolean).join("-");
4382
- const sizedAbbreviation = abbreviatedRoundNamingMap[matchUpsCount] || `${roundNamePrefix.roundNumber}${participantsCount}`;
4396
+ const sizedAbbreviation = abbreviatedRoundNamingMap[matchUpsCount] || `${roundNumberAffix}${participantsCount}`;
4383
4397
  const profileAbbreviation = `${sizedAbbreviation}${suffix}`;
4384
4398
  const abbreviatedRoundName = [
4385
4399
  stageConstant,
@@ -4552,6 +4566,7 @@ function getAllStructureMatchUps({
4552
4566
  const roundNamingPolicy = appliedPolicies?.[POLICY_TYPE_ROUND_NAMING];
4553
4567
  const result = getRoundContextProfile({
4554
4568
  roundNamingPolicy,
4569
+ drawDefinition,
4555
4570
  structure,
4556
4571
  matchUps
4557
4572
  });