tods-competition-factory 1.8.20 → 1.8.21
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/forge/generate.mjs +26 -10
- package/dist/forge/generate.mjs.map +1 -1
- package/dist/forge/query.d.ts +4 -3
- package/dist/forge/query.mjs +26 -10
- package/dist/forge/query.mjs.map +1 -1
- package/dist/forge/transform.mjs +28 -12
- package/dist/forge/transform.mjs.map +1 -1
- package/dist/index.mjs +54 -17
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +76 -30
- package/dist/tods-competition-factory.development.cjs.js.map +1 -1
- package/dist/tods-competition-factory.production.cjs.min.js +1 -1
- package/dist/tods-competition-factory.production.cjs.min.js.map +1 -1
- package/package.json +1 -1
package/dist/forge/transform.mjs
CHANGED
|
@@ -3746,8 +3746,8 @@ function unlinkTournament({
|
|
|
3746
3746
|
tournamentIds.every((currentTournamentId) => {
|
|
3747
3747
|
const tournamentRecord = tournamentRecords[currentTournamentId];
|
|
3748
3748
|
const { extension } = findTournamentExtension({
|
|
3749
|
-
|
|
3750
|
-
|
|
3749
|
+
name: LINKED_TOURNAMENTS,
|
|
3750
|
+
tournamentRecord
|
|
3751
3751
|
});
|
|
3752
3752
|
if (!extension)
|
|
3753
3753
|
return true;
|
|
@@ -5756,6 +5756,9 @@ const POLICY_ROUND_NAMING_DEFAULT = {
|
|
|
5756
5756
|
namingConventions: {
|
|
5757
5757
|
round: "Round"
|
|
5758
5758
|
},
|
|
5759
|
+
qualifyingFinishMap: {
|
|
5760
|
+
1: "Final"
|
|
5761
|
+
},
|
|
5759
5762
|
abbreviatedRoundNamingMap: {
|
|
5760
5763
|
// key is matchUpsCount for the round
|
|
5761
5764
|
1: "F",
|
|
@@ -5769,7 +5772,8 @@ const POLICY_ROUND_NAMING_DEFAULT = {
|
|
|
5769
5772
|
},
|
|
5770
5773
|
affixes: {
|
|
5771
5774
|
roundNumber: "R",
|
|
5772
|
-
preFeedRound: "Q"
|
|
5775
|
+
preFeedRound: "Q",
|
|
5776
|
+
preQualifying: "P"
|
|
5773
5777
|
},
|
|
5774
5778
|
stageConstants: {
|
|
5775
5779
|
[MAIN]: "",
|
|
@@ -5782,6 +5786,7 @@ const POLICY_ROUND_NAMING_DEFAULT = {
|
|
|
5782
5786
|
|
|
5783
5787
|
function getRoundContextProfile({
|
|
5784
5788
|
roundNamingPolicy,
|
|
5789
|
+
drawDefinition,
|
|
5785
5790
|
structure,
|
|
5786
5791
|
matchUps
|
|
5787
5792
|
}) {
|
|
@@ -5792,21 +5797,31 @@ function getRoundContextProfile({
|
|
|
5792
5797
|
const isRoundRobin = structure.structures;
|
|
5793
5798
|
const roundNamingProfile = {};
|
|
5794
5799
|
const defaultRoundNamingPolicy = POLICY_ROUND_NAMING_DEFAULT[POLICY_TYPE_ROUND_NAMING];
|
|
5800
|
+
const isQualifying = structure.stage === QUALIFYING;
|
|
5801
|
+
const qualifyingFinishgMap = isQualifying && (roundNamingPolicy?.qualifyingFinishMap || defaultRoundNamingPolicy?.qualifyingFinishMap || {});
|
|
5802
|
+
const qualifyingStageSequences = isQualifying ? Math.max(
|
|
5803
|
+
...(drawDefinition?.structures ?? []).filter((structure2) => structure2.stage === QUALIFYING).map(({ stageSequence }) => stageSequence ?? 1),
|
|
5804
|
+
0
|
|
5805
|
+
) : 0;
|
|
5806
|
+
const preQualifyingSequence = qualifyingStageSequences ? qualifyingStageSequences - (structure.stageSequence || 1) || "" : "";
|
|
5807
|
+
const preQualifyingAffix = preQualifyingSequence ? roundNamingPolicy?.affixes?.preQualifying || defaultRoundNamingPolicy.affixes.preQualifying || "" : "";
|
|
5795
5808
|
const roundNamingMap = roundNamingPolicy?.roundNamingMap || defaultRoundNamingPolicy.roundNamingMap || {};
|
|
5796
5809
|
const abbreviatedRoundNamingMap = roundNamingPolicy?.abbreviatedRoundNamingMap || defaultRoundNamingPolicy.abbreviatedRoundNamingMap || {};
|
|
5797
|
-
const
|
|
5798
|
-
const roundNumberAffix =
|
|
5810
|
+
const preFeedAffix = roundNamingPolicy?.affixes?.preFeedRound || defaultRoundNamingPolicy.affixes.preFeedRound;
|
|
5811
|
+
const roundNumberAffix = roundNamingPolicy?.affixes?.roundNumber || defaultRoundNamingPolicy.affixes.roundNumber;
|
|
5799
5812
|
const namingConventions = roundNamingPolicy?.namingConventions || defaultRoundNamingPolicy.namingConventions;
|
|
5800
5813
|
const roundNameFallback = namingConventions.round;
|
|
5801
|
-
const stageInitial = stage && stage !== MAIN
|
|
5802
|
-
const stageConstants = roundNamingPolicy?.stageConstants;
|
|
5803
|
-
const
|
|
5814
|
+
const stageInitial = stage && stage !== MAIN ? stage[0] : "";
|
|
5815
|
+
const stageConstants = roundNamingPolicy?.stageConstants || defaultRoundNamingPolicy.stageConstants;
|
|
5816
|
+
const stageIndicator = stage && stageConstants?.[stage] || stageInitial;
|
|
5817
|
+
const stageConstant = `${preQualifyingAffix}${stageIndicator}${preQualifyingSequence}`;
|
|
5804
5818
|
const roundProfileKeys = roundProfile ? Object.keys(roundProfile) : [];
|
|
5819
|
+
const qualifyingAffix = isQualifying && stageConstants?.[QUALIFYING] ? `${stageConstants?.[QUALIFYING]}-` : "";
|
|
5805
5820
|
if (isRoundRobin || isAdHocStructure || isLuckyStructure) {
|
|
5806
5821
|
Object.assign(
|
|
5807
5822
|
roundNamingProfile,
|
|
5808
5823
|
...roundProfileKeys.map((key) => {
|
|
5809
|
-
const roundName = `${roundNameFallback} ${key}`;
|
|
5824
|
+
const roundName = `${qualifyingAffix}${roundNameFallback} ${key}`;
|
|
5810
5825
|
const abbreviatedRoundName = `${roundNumberAffix}${key}`;
|
|
5811
5826
|
return { [key]: { roundName, abbreviatedRoundName } };
|
|
5812
5827
|
})
|
|
@@ -5819,15 +5834,15 @@ function getRoundContextProfile({
|
|
|
5819
5834
|
return;
|
|
5820
5835
|
const { matchUpsCount, preFeedRound } = roundProfile[round];
|
|
5821
5836
|
const participantsCount = matchUpsCount * 2;
|
|
5822
|
-
const sizedRoundName = roundNamingMap[matchUpsCount] || `${
|
|
5823
|
-
const suffix = preFeedRound ? `-${
|
|
5837
|
+
const sizedRoundName = qualifyingFinishgMap?.[roundProfile?.[round].finishingRound] || qualifyingFinishgMap && `${roundNumberAffix}${participantsCount}` || roundNamingMap[matchUpsCount] || `${roundNumberAffix}${participantsCount}`;
|
|
5838
|
+
const suffix = preFeedRound ? `-${preFeedAffix}` : "";
|
|
5824
5839
|
const profileRoundName = `${sizedRoundName}${suffix}`;
|
|
5825
5840
|
const roundName = [
|
|
5826
5841
|
stageConstant,
|
|
5827
5842
|
structureAbbreviation,
|
|
5828
5843
|
profileRoundName
|
|
5829
5844
|
].filter(Boolean).join("-");
|
|
5830
|
-
const sizedAbbreviation = abbreviatedRoundNamingMap[matchUpsCount] || `${
|
|
5845
|
+
const sizedAbbreviation = abbreviatedRoundNamingMap[matchUpsCount] || `${roundNumberAffix}${participantsCount}`;
|
|
5831
5846
|
const profileAbbreviation = `${sizedAbbreviation}${suffix}`;
|
|
5832
5847
|
const abbreviatedRoundName = [
|
|
5833
5848
|
stageConstant,
|
|
@@ -6000,6 +6015,7 @@ function getAllStructureMatchUps({
|
|
|
6000
6015
|
const roundNamingPolicy = appliedPolicies?.[POLICY_TYPE_ROUND_NAMING];
|
|
6001
6016
|
const result = getRoundContextProfile({
|
|
6002
6017
|
roundNamingPolicy,
|
|
6018
|
+
drawDefinition,
|
|
6003
6019
|
structure,
|
|
6004
6020
|
matchUps
|
|
6005
6021
|
});
|