tods-competition-factory 1.7.5 → 1.7.6
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 +23 -11
- package/dist/forge/generate.mjs.map +1 -1
- package/dist/forge/query.mjs +11 -11
- package/dist/forge/query.mjs.map +1 -1
- package/dist/forge/transform.mjs +9 -9
- package/dist/forge/transform.mjs.map +1 -1
- package/dist/index.mjs +58 -30
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +82 -38
- 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 +5 -5
package/dist/forge/transform.mjs
CHANGED
|
@@ -3163,7 +3163,7 @@ const DECISIVE = "DECISIVE";
|
|
|
3163
3163
|
const POLICY_COMPETITIVE_BANDS_DEFAULT = {
|
|
3164
3164
|
[POLICY_TYPE_COMPETITIVE_BANDS]: {
|
|
3165
3165
|
policyName: "Competitive Bands Default",
|
|
3166
|
-
|
|
3166
|
+
profileBands: {
|
|
3167
3167
|
[DECISIVE]: 20,
|
|
3168
3168
|
[ROUTINE]: 50
|
|
3169
3169
|
}
|
|
@@ -3248,7 +3248,7 @@ function gamesPercent(scoreComponents) {
|
|
|
3248
3248
|
return Math.round(minGames / maxGames * 100);
|
|
3249
3249
|
}
|
|
3250
3250
|
function pctSpread(pcts) {
|
|
3251
|
-
return pcts.map(gamesPercent).sort().map((p) => p.toFixed(2));
|
|
3251
|
+
return pcts.map(gamesPercent).sort().map((p) => parseFloat(p.toFixed(2)));
|
|
3252
3252
|
}
|
|
3253
3253
|
|
|
3254
3254
|
function findPolicy({
|
|
@@ -3269,8 +3269,8 @@ function findPolicy({
|
|
|
3269
3269
|
return appliedPolicies?.[policyType] ? { policy: appliedPolicies[policyType] } : { error: POLICY_NOT_FOUND };
|
|
3270
3270
|
}
|
|
3271
3271
|
|
|
3272
|
-
function
|
|
3273
|
-
|
|
3272
|
+
function getMatchUpCompetitiveProfile({
|
|
3273
|
+
profileBands,
|
|
3274
3274
|
tournamentRecord,
|
|
3275
3275
|
matchUp
|
|
3276
3276
|
}) {
|
|
@@ -3279,15 +3279,15 @@ function getMatchUpCompetitiveness({
|
|
|
3279
3279
|
const { score, winningSide } = matchUp;
|
|
3280
3280
|
if (!winningSide)
|
|
3281
3281
|
return { error: INVALID_VALUES };
|
|
3282
|
-
const policy = !
|
|
3282
|
+
const policy = !profileBands && tournamentRecord && findPolicy({
|
|
3283
3283
|
policyType: POLICY_TYPE_COMPETITIVE_BANDS,
|
|
3284
3284
|
tournamentRecord
|
|
3285
3285
|
}).policy;
|
|
3286
|
-
const bandProfiles =
|
|
3286
|
+
const bandProfiles = profileBands || policy?.profileBands || POLICY_COMPETITIVE_BANDS_DEFAULT[POLICY_TYPE_COMPETITIVE_BANDS].profileBands;
|
|
3287
3287
|
const scoreComponents = getScoreComponents({ score });
|
|
3288
3288
|
const spread = pctSpread([scoreComponents]);
|
|
3289
3289
|
const competitiveness = getBand(spread, bandProfiles);
|
|
3290
|
-
return { ...SUCCESS, competitiveness };
|
|
3290
|
+
return { ...SUCCESS, competitiveness, pctSpread: spread };
|
|
3291
3291
|
}
|
|
3292
3292
|
|
|
3293
3293
|
function findMatchupFormatAverageTimes(params) {
|
|
@@ -5965,7 +5965,7 @@ function getAllStructureMatchUps({
|
|
|
5965
5965
|
...collectionDefinition.category
|
|
5966
5966
|
} : context?.category;
|
|
5967
5967
|
const processCodes = matchUp.processCodes?.length && matchUp.processCodes || collectionDefinition?.processCodes?.length && collectionDefinition?.processCodes || structure?.processCodes?.length && structure?.processCodes || drawDefinition?.processCodes?.length && drawDefinition?.processCodes || event2?.processCodes?.length && event2?.processCodes || tournamentRecord?.processCodes;
|
|
5968
|
-
const
|
|
5968
|
+
const competitiveProfile = contextProfile?.withCompetitiveness && getMatchUpCompetitiveProfile({ ...contextContent, matchUp });
|
|
5969
5969
|
const finishingPositionRange = matchUp.finishingPositionRange || additionalContext.finishingPositionRange;
|
|
5970
5970
|
const onlyDefined = (obj) => definedAttributes(obj, void 0, true);
|
|
5971
5971
|
const matchUpWithContext = {
|
|
@@ -5981,7 +5981,7 @@ function getAllStructureMatchUps({
|
|
|
5981
5981
|
finishingPositionRange,
|
|
5982
5982
|
abbreviatedRoundName,
|
|
5983
5983
|
drawPositionsRange,
|
|
5984
|
-
|
|
5984
|
+
competitiveProfile,
|
|
5985
5985
|
structureName,
|
|
5986
5986
|
stageSequence,
|
|
5987
5987
|
drawPositions,
|