tods-competition-factory 1.7.6 → 1.7.7
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 +19 -6
- package/dist/forge/generate.mjs.map +1 -1
- package/dist/forge/query.mjs +12 -4
- package/dist/forge/query.mjs.map +1 -1
- package/dist/forge/transform.mjs +14 -6
- package/dist/forge/transform.mjs.map +1 -1
- package/dist/forge/utilities.mjs.map +1 -1
- package/dist/index.mjs +192 -54
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +196 -52
- 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 +3 -3
package/dist/forge/generate.mjs
CHANGED
|
@@ -1349,7 +1349,8 @@ const WIN_RATIO$1 = "winRatio";
|
|
|
1349
1349
|
|
|
1350
1350
|
const add = (a, b) => (a || 0) + (b || 0);
|
|
1351
1351
|
function getBand(spread, bandProfiles) {
|
|
1352
|
-
|
|
1352
|
+
const spreadValue = Array.isArray(spread) ? spread[0] : spread;
|
|
1353
|
+
return isNaN(spreadValue) && WALKOVER || spreadValue <= bandProfiles[DECISIVE] && DECISIVE || spreadValue <= bandProfiles[ROUTINE] && ROUTINE || COMPETITIVE;
|
|
1353
1354
|
}
|
|
1354
1355
|
function getScoreComponents({ score }) {
|
|
1355
1356
|
const sets = score?.sets || [];
|
|
@@ -1407,6 +1408,7 @@ const POLICY_TYPE_MATCHUP_ACTIONS = "matchUpActions";
|
|
|
1407
1408
|
const POLICY_TYPE_ROUND_NAMING = "roundNaming";
|
|
1408
1409
|
const POLICY_TYPE_PARTICIPANT = "participant";
|
|
1409
1410
|
const POLICY_TYPE_SCHEDULING = "scheduling";
|
|
1411
|
+
const POLICY_TYPE_DISPLAY = "display";
|
|
1410
1412
|
const POLICY_TYPE_SCORING = "scoring";
|
|
1411
1413
|
const POLICY_TYPE_SEEDING = "seeding";
|
|
1412
1414
|
const POLICY_TYPE_FEED_IN = "feedIn";
|
|
@@ -1440,7 +1442,8 @@ function getMatchUpCompetitiveProfile({
|
|
|
1440
1442
|
const scoreComponents = getScoreComponents({ score });
|
|
1441
1443
|
const spread = pctSpread([scoreComponents]);
|
|
1442
1444
|
const competitiveness = getBand(spread, bandProfiles);
|
|
1443
|
-
|
|
1445
|
+
const pctSpreadValue = Array.isArray(spread) ? spread[0] : spread;
|
|
1446
|
+
return { ...SUCCESS, competitiveness, pctSpread: pctSpreadValue };
|
|
1444
1447
|
}
|
|
1445
1448
|
|
|
1446
1449
|
function findMatchupFormatAverageTimes(params) {
|
|
@@ -4259,6 +4262,9 @@ function isAdHoc({ drawDefinition, structure }) {
|
|
|
4259
4262
|
const POLICY_ROUND_NAMING_DEFAULT = {
|
|
4260
4263
|
[POLICY_TYPE_ROUND_NAMING]: {
|
|
4261
4264
|
policyName: "Round Naming Default",
|
|
4265
|
+
namingConventions: {
|
|
4266
|
+
round: "Round"
|
|
4267
|
+
},
|
|
4262
4268
|
abbreviatedRoundNamingMap: {
|
|
4263
4269
|
// key is matchUpsCount for the round
|
|
4264
4270
|
1: "F",
|
|
@@ -4298,6 +4304,9 @@ function getRoundContextProfile({
|
|
|
4298
4304
|
const roundNamingMap = roundNamingPolicy?.roundNamingMap || defaultRoundNamingPolicy.roundNamingMap || {};
|
|
4299
4305
|
const abbreviatedRoundNamingMap = roundNamingPolicy?.abbreviatedRoundNamingMap || defaultRoundNamingPolicy.abbreviatedRoundNamingMap || {};
|
|
4300
4306
|
const roundNamePrefix = roundNamingPolicy?.affixes || defaultRoundNamingPolicy.affixes;
|
|
4307
|
+
const roundNumberAffix = roundNamePrefix.roundNumber || defaultRoundNamingPolicy.affixes.roundNumber;
|
|
4308
|
+
const namingConventions = roundNamingPolicy?.namingConventions || defaultRoundNamingPolicy.namingConventions;
|
|
4309
|
+
const roundNameFallback = namingConventions.round;
|
|
4301
4310
|
const stageInitial = stage && stage !== MAIN && stage[0];
|
|
4302
4311
|
const stageConstants = roundNamingPolicy?.stageConstants;
|
|
4303
4312
|
const stageConstant = stage && stageConstants?.[stage] || stageInitial;
|
|
@@ -4306,8 +4315,8 @@ function getRoundContextProfile({
|
|
|
4306
4315
|
Object.assign(
|
|
4307
4316
|
roundNamingProfile,
|
|
4308
4317
|
...roundProfileKeys.map((key) => {
|
|
4309
|
-
const roundName =
|
|
4310
|
-
const abbreviatedRoundName =
|
|
4318
|
+
const roundName = `${roundNameFallback} ${key}`;
|
|
4319
|
+
const abbreviatedRoundName = `${roundNumberAffix}${key}`;
|
|
4311
4320
|
return { [key]: { roundName, abbreviatedRoundName } };
|
|
4312
4321
|
})
|
|
4313
4322
|
);
|
|
@@ -20995,7 +21004,10 @@ function addDrawDefinition(params) {
|
|
|
20995
21004
|
return { ...SUCCESS, modifiedEventEntryStatusCount };
|
|
20996
21005
|
}
|
|
20997
21006
|
|
|
20998
|
-
function attachPolicies({
|
|
21007
|
+
function attachPolicies({
|
|
21008
|
+
drawDefinition,
|
|
21009
|
+
policyDefinitions
|
|
21010
|
+
}) {
|
|
20999
21011
|
if (!drawDefinition) {
|
|
21000
21012
|
return { error: MISSING_DRAW_DEFINITION };
|
|
21001
21013
|
}
|
|
@@ -21005,8 +21017,9 @@ function attachPolicies({ drawDefinition, policyDefinitions }) {
|
|
|
21005
21017
|
if (!drawDefinition.extensions)
|
|
21006
21018
|
drawDefinition.extensions = [];
|
|
21007
21019
|
const appliedPolicies = getAppliedPolicies({ drawDefinition })?.appliedPolicies ?? {};
|
|
21020
|
+
const validReplacements = [POLICY_TYPE_ROUND_NAMING, POLICY_TYPE_DISPLAY];
|
|
21008
21021
|
const applied = Object.keys(policyDefinitions).every((policyType) => {
|
|
21009
|
-
if (!appliedPolicies[policyType]) {
|
|
21022
|
+
if (!appliedPolicies[policyType] || validReplacements.includes(policyType)) {
|
|
21010
21023
|
appliedPolicies[policyType] = policyDefinitions[policyType];
|
|
21011
21024
|
return true;
|
|
21012
21025
|
} else {
|