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/generate.mjs
CHANGED
|
@@ -1380,7 +1380,7 @@ function gamesPercent(scoreComponents) {
|
|
|
1380
1380
|
return Math.round(minGames / maxGames * 100);
|
|
1381
1381
|
}
|
|
1382
1382
|
function pctSpread(pcts) {
|
|
1383
|
-
return pcts.map(gamesPercent).sort().map((p) => p.toFixed(2));
|
|
1383
|
+
return pcts.map(gamesPercent).sort().map((p) => parseFloat(p.toFixed(2)));
|
|
1384
1384
|
}
|
|
1385
1385
|
|
|
1386
1386
|
function findPolicy({
|
|
@@ -1415,15 +1415,15 @@ const POLICY_TYPE_DRAWS = "draws";
|
|
|
1415
1415
|
const POLICY_COMPETITIVE_BANDS_DEFAULT = {
|
|
1416
1416
|
[POLICY_TYPE_COMPETITIVE_BANDS]: {
|
|
1417
1417
|
policyName: "Competitive Bands Default",
|
|
1418
|
-
|
|
1418
|
+
profileBands: {
|
|
1419
1419
|
[DECISIVE]: 20,
|
|
1420
1420
|
[ROUTINE]: 50
|
|
1421
1421
|
}
|
|
1422
1422
|
}
|
|
1423
1423
|
};
|
|
1424
1424
|
|
|
1425
|
-
function
|
|
1426
|
-
|
|
1425
|
+
function getMatchUpCompetitiveProfile({
|
|
1426
|
+
profileBands,
|
|
1427
1427
|
tournamentRecord,
|
|
1428
1428
|
matchUp
|
|
1429
1429
|
}) {
|
|
@@ -1432,15 +1432,15 @@ function getMatchUpCompetitiveness({
|
|
|
1432
1432
|
const { score, winningSide } = matchUp;
|
|
1433
1433
|
if (!winningSide)
|
|
1434
1434
|
return { error: INVALID_VALUES };
|
|
1435
|
-
const policy = !
|
|
1435
|
+
const policy = !profileBands && tournamentRecord && findPolicy({
|
|
1436
1436
|
policyType: POLICY_TYPE_COMPETITIVE_BANDS,
|
|
1437
1437
|
tournamentRecord
|
|
1438
1438
|
}).policy;
|
|
1439
|
-
const bandProfiles =
|
|
1439
|
+
const bandProfiles = profileBands || policy?.profileBands || POLICY_COMPETITIVE_BANDS_DEFAULT[POLICY_TYPE_COMPETITIVE_BANDS].profileBands;
|
|
1440
1440
|
const scoreComponents = getScoreComponents({ score });
|
|
1441
1441
|
const spread = pctSpread([scoreComponents]);
|
|
1442
1442
|
const competitiveness = getBand(spread, bandProfiles);
|
|
1443
|
-
return { ...SUCCESS, competitiveness };
|
|
1443
|
+
return { ...SUCCESS, competitiveness, pctSpread: spread };
|
|
1444
1444
|
}
|
|
1445
1445
|
|
|
1446
1446
|
function findMatchupFormatAverageTimes(params) {
|
|
@@ -4654,7 +4654,7 @@ function getAllStructureMatchUps({
|
|
|
4654
4654
|
...collectionDefinition.category
|
|
4655
4655
|
} : context?.category;
|
|
4656
4656
|
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;
|
|
4657
|
-
const
|
|
4657
|
+
const competitiveProfile = contextProfile?.withCompetitiveness && getMatchUpCompetitiveProfile({ ...contextContent, matchUp });
|
|
4658
4658
|
const finishingPositionRange = matchUp.finishingPositionRange || additionalContext.finishingPositionRange;
|
|
4659
4659
|
const onlyDefined = (obj) => definedAttributes(obj, void 0, true);
|
|
4660
4660
|
const matchUpWithContext = {
|
|
@@ -4670,7 +4670,7 @@ function getAllStructureMatchUps({
|
|
|
4670
4670
|
finishingPositionRange,
|
|
4671
4671
|
abbreviatedRoundName,
|
|
4672
4672
|
drawPositionsRange,
|
|
4673
|
-
|
|
4673
|
+
competitiveProfile,
|
|
4674
4674
|
structureName,
|
|
4675
4675
|
stageSequence,
|
|
4676
4676
|
drawPositions,
|
|
@@ -19746,6 +19746,10 @@ function addAdHocMatchUps({
|
|
|
19746
19746
|
return { ...SUCCESS };
|
|
19747
19747
|
}
|
|
19748
19748
|
|
|
19749
|
+
function stringSort(a, b) {
|
|
19750
|
+
return (a || "").localeCompare(b || "");
|
|
19751
|
+
}
|
|
19752
|
+
|
|
19749
19753
|
function generateCandidate({
|
|
19750
19754
|
maxIterations = 4e3,
|
|
19751
19755
|
// cap the processing intensity of the candidate generator
|
|
@@ -19880,7 +19884,7 @@ function roundCandidate({
|
|
|
19880
19884
|
return { value: candidateValue, participantIdPairings, maxDelta, maxDiff };
|
|
19881
19885
|
}
|
|
19882
19886
|
function pairingHash(id1, id2) {
|
|
19883
|
-
return [id1, id2].sort().join("|");
|
|
19887
|
+
return [id1, id2].sort(stringSort).join("|");
|
|
19884
19888
|
}
|
|
19885
19889
|
|
|
19886
19890
|
function getPairingsData({ participantIds }) {
|
|
@@ -19945,13 +19949,19 @@ const UTR = "UTR";
|
|
|
19945
19949
|
const WTN = "WTN";
|
|
19946
19950
|
|
|
19947
19951
|
const ratingsParameters = {
|
|
19948
|
-
[ELO]: {
|
|
19952
|
+
[ELO]: {
|
|
19953
|
+
defaultInitialization: 1500,
|
|
19954
|
+
decimalsCount: 0,
|
|
19955
|
+
range: [0, 3e3],
|
|
19956
|
+
ascending: true
|
|
19957
|
+
},
|
|
19949
19958
|
[NTRP]: {
|
|
19950
19959
|
accessors: ["ntrpRating", "dntrpRatingHundredths"],
|
|
19951
19960
|
attributes: { ustaRatingType: "" },
|
|
19952
19961
|
accessor: "dntrpRatingHundredths",
|
|
19953
19962
|
defaultInitialization: 3,
|
|
19954
19963
|
decimalsCount: 1,
|
|
19964
|
+
ascending: true,
|
|
19955
19965
|
range: [1, 7]
|
|
19956
19966
|
},
|
|
19957
19967
|
[UTR]: {
|
|
@@ -19959,6 +19969,7 @@ const ratingsParameters = {
|
|
|
19959
19969
|
accessors: ["utrRating"],
|
|
19960
19970
|
accessor: "utrRating",
|
|
19961
19971
|
decimalsCount: 2,
|
|
19972
|
+
ascending: true,
|
|
19962
19973
|
range: [1, 16]
|
|
19963
19974
|
},
|
|
19964
19975
|
[WTN]: {
|
|
@@ -19966,6 +19977,7 @@ const ratingsParameters = {
|
|
|
19966
19977
|
accessors: ["wtnRating", "confidence"],
|
|
19967
19978
|
defaultInitialization: 23,
|
|
19968
19979
|
accessor: "wtnRating",
|
|
19980
|
+
ascending: false,
|
|
19969
19981
|
decimalsCount: 2,
|
|
19970
19982
|
range: [40, 1]
|
|
19971
19983
|
}
|