tods-competition-factory 1.7.4 → 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.d.ts +9 -2
- package/dist/forge/generate.mjs +47 -23
- package/dist/forge/generate.mjs.map +1 -1
- package/dist/forge/query.mjs +14 -13
- package/dist/forge/query.mjs.map +1 -1
- package/dist/forge/transform.mjs +12 -11
- package/dist/forge/transform.mjs.map +1 -1
- package/dist/index.mjs +82 -42
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +102 -57
- 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/query.mjs
CHANGED
|
@@ -936,14 +936,15 @@ function getScaleValues({ participant }) {
|
|
|
936
936
|
for (const itemType of itemTypes) {
|
|
937
937
|
const scaleItem = latestScaleItem(itemType);
|
|
938
938
|
if (scaleItem) {
|
|
939
|
-
const [, type, format, scaleName] = scaleItem.itemType.split(".");
|
|
939
|
+
const [, type, format, scaleName, modifier] = scaleItem.itemType.split(".");
|
|
940
|
+
const namedScale = modifier ? `${scaleName}.${modifier}` : scaleName;
|
|
940
941
|
const scaleType = type === SEEDING && "seedings" || type === RANKING && "rankings" || "ratings";
|
|
941
942
|
if (!scales[scaleType][format])
|
|
942
943
|
scales[scaleType][format] = [];
|
|
943
944
|
scales[scaleType][format].push({
|
|
944
945
|
scaleValue: scaleItem.itemValue,
|
|
945
946
|
scaleDate: scaleItem.itemDate,
|
|
946
|
-
scaleName
|
|
947
|
+
scaleName: namedScale
|
|
947
948
|
});
|
|
948
949
|
}
|
|
949
950
|
}
|
|
@@ -3832,7 +3833,7 @@ const WIN_RATIO = "winRatio";
|
|
|
3832
3833
|
const POLICY_COMPETITIVE_BANDS_DEFAULT = {
|
|
3833
3834
|
[POLICY_TYPE_COMPETITIVE_BANDS]: {
|
|
3834
3835
|
policyName: "Competitive Bands Default",
|
|
3835
|
-
|
|
3836
|
+
profileBands: {
|
|
3836
3837
|
[DECISIVE]: 20,
|
|
3837
3838
|
[ROUTINE]: 50
|
|
3838
3839
|
}
|
|
@@ -4921,11 +4922,11 @@ function gamesPercent(scoreComponents) {
|
|
|
4921
4922
|
return Math.round(minGames / maxGames * 100);
|
|
4922
4923
|
}
|
|
4923
4924
|
function pctSpread(pcts) {
|
|
4924
|
-
return pcts.map(gamesPercent).sort().map((p) => p.toFixed(2));
|
|
4925
|
+
return pcts.map(gamesPercent).sort().map((p) => parseFloat(p.toFixed(2)));
|
|
4925
4926
|
}
|
|
4926
4927
|
|
|
4927
|
-
function
|
|
4928
|
-
|
|
4928
|
+
function getMatchUpCompetitiveProfile({
|
|
4929
|
+
profileBands,
|
|
4929
4930
|
tournamentRecord,
|
|
4930
4931
|
matchUp
|
|
4931
4932
|
}) {
|
|
@@ -4934,15 +4935,15 @@ function getMatchUpCompetitiveness({
|
|
|
4934
4935
|
const { score, winningSide } = matchUp;
|
|
4935
4936
|
if (!winningSide)
|
|
4936
4937
|
return { error: INVALID_VALUES };
|
|
4937
|
-
const policy = !
|
|
4938
|
+
const policy = !profileBands && tournamentRecord && findPolicy({
|
|
4938
4939
|
policyType: POLICY_TYPE_COMPETITIVE_BANDS,
|
|
4939
4940
|
tournamentRecord
|
|
4940
4941
|
}).policy;
|
|
4941
|
-
const bandProfiles =
|
|
4942
|
+
const bandProfiles = profileBands || policy?.profileBands || POLICY_COMPETITIVE_BANDS_DEFAULT[POLICY_TYPE_COMPETITIVE_BANDS].profileBands;
|
|
4942
4943
|
const scoreComponents = getScoreComponents({ score });
|
|
4943
4944
|
const spread = pctSpread([scoreComponents]);
|
|
4944
4945
|
const competitiveness = getBand(spread, bandProfiles);
|
|
4945
|
-
return { ...SUCCESS, competitiveness };
|
|
4946
|
+
return { ...SUCCESS, competitiveness, pctSpread: spread };
|
|
4946
4947
|
}
|
|
4947
4948
|
|
|
4948
4949
|
function findMatchupFormatAverageTimes(params) {
|
|
@@ -7166,7 +7167,7 @@ function getAllStructureMatchUps({
|
|
|
7166
7167
|
...collectionDefinition.category
|
|
7167
7168
|
} : context?.category;
|
|
7168
7169
|
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;
|
|
7169
|
-
const
|
|
7170
|
+
const competitiveProfile = contextProfile?.withCompetitiveness && getMatchUpCompetitiveProfile({ ...contextContent, matchUp });
|
|
7170
7171
|
const finishingPositionRange = matchUp.finishingPositionRange || additionalContext.finishingPositionRange;
|
|
7171
7172
|
const onlyDefined = (obj) => definedAttributes(obj, void 0, true);
|
|
7172
7173
|
const matchUpWithContext = {
|
|
@@ -7182,7 +7183,7 @@ function getAllStructureMatchUps({
|
|
|
7182
7183
|
finishingPositionRange,
|
|
7183
7184
|
abbreviatedRoundName,
|
|
7184
7185
|
drawPositionsRange,
|
|
7185
|
-
|
|
7186
|
+
competitiveProfile,
|
|
7186
7187
|
structureName,
|
|
7187
7188
|
stageSequence,
|
|
7188
7189
|
drawPositions,
|
|
@@ -10333,8 +10334,8 @@ function getUpdatedSchedulingProfile({
|
|
|
10333
10334
|
}
|
|
10334
10335
|
|
|
10335
10336
|
function scheduledSortedMatchUps({
|
|
10336
|
-
|
|
10337
|
-
|
|
10337
|
+
schedulingProfile,
|
|
10338
|
+
matchUps = []
|
|
10338
10339
|
}) {
|
|
10339
10340
|
const profileHash = {};
|
|
10340
10341
|
const getHash = ({ eventId, drawId, structureId, roundNumber }) => {
|