tods-competition-factory 2.0.36 → 2.0.39
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/index.mjs +5 -5
- package/dist/tods-competition-factory.development.cjs.js +27 -16
- 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
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
function factoryVersion() {
|
|
6
|
-
return '2.0.
|
|
6
|
+
return '2.0.39';
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
function isFunction(obj) {
|
|
@@ -19907,6 +19907,14 @@ function calculatePercentages({ participantResults, matchUpFormat, tallyPolicy,
|
|
|
19907
19907
|
});
|
|
19908
19908
|
}
|
|
19909
19909
|
|
|
19910
|
+
function convertRange({ value, sourceRange, targetRange }) {
|
|
19911
|
+
const minSourceRange = Math.min(...sourceRange);
|
|
19912
|
+
const maxSourceRange = Math.max(...sourceRange);
|
|
19913
|
+
const minTargetRange = Math.min(...targetRange);
|
|
19914
|
+
const maxTargetRange = Math.max(...targetRange);
|
|
19915
|
+
return (((value - minSourceRange) * (maxTargetRange - minTargetRange)) / (maxSourceRange - minSourceRange) + minTargetRange);
|
|
19916
|
+
}
|
|
19917
|
+
|
|
19910
19918
|
const ELO = 'ELO';
|
|
19911
19919
|
const NTRP = 'NTRP';
|
|
19912
19920
|
const TRN = 'TRN';
|
|
@@ -19955,10 +19963,6 @@ const ratingsParameters = {
|
|
|
19955
19963
|
},
|
|
19956
19964
|
};
|
|
19957
19965
|
|
|
19958
|
-
function convertRange({ value, sourceRange, targetRange }) {
|
|
19959
|
-
return (((value - sourceRange[0]) * (targetRange[1] - targetRange[0])) / (sourceRange[1] - sourceRange[0]) + targetRange[0]);
|
|
19960
|
-
}
|
|
19961
|
-
|
|
19962
19966
|
function getRatingConvertedToELO({ sourceRatingType, sourceRating }) {
|
|
19963
19967
|
const sourceRatingRange = ratingsParameters[sourceRatingType].range;
|
|
19964
19968
|
const invertedScale = sourceRatingRange[0] > sourceRatingRange[1];
|
|
@@ -19973,14 +19977,15 @@ function getRatingConvertedFromELO({ targetRatingType, sourceRating }) {
|
|
|
19973
19977
|
const decimalPlaces = ratingsParameters[targetRatingType].decimalsCount || 0;
|
|
19974
19978
|
const targetRatingRange = ratingsParameters[targetRatingType].range;
|
|
19975
19979
|
const invertedScale = targetRatingRange[0] > targetRatingRange[1];
|
|
19980
|
+
const maxTargetRatingRange = Math.max(...targetRatingRange);
|
|
19976
19981
|
const eloRatingRange = ratingsParameters[ELO].range;
|
|
19977
19982
|
const result = convertRange({
|
|
19978
19983
|
targetRange: targetRatingRange,
|
|
19979
19984
|
sourceRange: eloRatingRange,
|
|
19980
19985
|
value: sourceRating,
|
|
19981
19986
|
});
|
|
19982
|
-
const convertedRating = parseFloat(
|
|
19983
|
-
return invertedScale ?
|
|
19987
|
+
const convertedRating = parseFloat(result.toFixed(decimalPlaces));
|
|
19988
|
+
return invertedScale ? maxTargetRatingRange - convertedRating : convertedRating;
|
|
19984
19989
|
}
|
|
19985
19990
|
|
|
19986
19991
|
function getConvertedRating(params) {
|
|
@@ -19999,14 +20004,15 @@ function getConvertedRating(params) {
|
|
|
19999
20004
|
params.ratings[matchUpType][0];
|
|
20000
20005
|
if (sourceRatings[0] === targetRatingType)
|
|
20001
20006
|
return sourceRatingObject;
|
|
20007
|
+
const sourceRatingType = sourceRatingObject.scaleName;
|
|
20002
20008
|
const accessor = ratingsParameters[sourceRatingObject.scaleName].accessor;
|
|
20003
|
-
const
|
|
20004
|
-
const eloValue = getRatingConvertedToELO({ sourceRatingType
|
|
20009
|
+
const sourceRating = accessor ? sourceRatingObject.scaleValue[accessor] : sourceRatingObject.scaleValue;
|
|
20010
|
+
const eloValue = getRatingConvertedToELO({ sourceRatingType, sourceRating });
|
|
20005
20011
|
const convertedRating = getRatingConvertedFromELO({
|
|
20006
20012
|
targetRatingType: targetRatingType,
|
|
20007
20013
|
sourceRating: eloValue,
|
|
20008
20014
|
});
|
|
20009
|
-
return { convertedRating };
|
|
20015
|
+
return { convertedRating, sourceRating };
|
|
20010
20016
|
}
|
|
20011
20017
|
|
|
20012
20018
|
function getParticipantResults({ participantIds, pressureRating, matchUpFormat, tallyPolicy, perPlayer, matchUps, }) {
|
|
@@ -20224,6 +20230,7 @@ function checkInitializeParticipant(participantResults, participantId) {
|
|
|
20224
20230
|
pointsLost: 0,
|
|
20225
20231
|
pointsWon: 0,
|
|
20226
20232
|
pressureScores: [],
|
|
20233
|
+
ratingVariation: [],
|
|
20227
20234
|
retirements: 0,
|
|
20228
20235
|
setsLost: 0,
|
|
20229
20236
|
setsWon: 0,
|
|
@@ -20271,12 +20278,15 @@ function processMatchUp({ winningParticipantId, manualGamesOverride, losingParti
|
|
|
20271
20278
|
const gamesWonSide2 = score?.sets?.reduce((total, set) => total + (set.side2Score ?? 0), 0);
|
|
20272
20279
|
const side1 = sides.find(({ sideNumber }) => sideNumber === 1);
|
|
20273
20280
|
const side2 = sides.find(({ sideNumber }) => sideNumber === 2);
|
|
20274
|
-
const side1ConvertedRating = getConvertedRating({ ratings: side1?.participant?.ratings })
|
|
20275
|
-
const side2ConvertedRating = getConvertedRating({ ratings: side2?.participant?.ratings })
|
|
20281
|
+
const { convertedRating: side1ConvertedRating } = getConvertedRating({ ratings: side1?.participant?.ratings });
|
|
20282
|
+
const { convertedRating: side2ConvertedRating } = getConvertedRating({ ratings: side2?.participant?.ratings });
|
|
20276
20283
|
const side1Value = gamesWonSide1 * side2ConvertedRating;
|
|
20277
20284
|
const side2Value = gamesWonSide2 * side1ConvertedRating;
|
|
20278
20285
|
participantResults[side1?.participantId].pressureScores.push(fixed2(side1Value / (side1Value + side2Value)));
|
|
20279
|
-
participantResults[side2?.participantId].pressureScores.push(fixed2(
|
|
20286
|
+
participantResults[side2?.participantId].pressureScores.push(fixed2(side2Value / (side1Value + side2Value)));
|
|
20287
|
+
const highRange = Math.max(...ratingsParameters[ELO].range);
|
|
20288
|
+
participantResults[side1?.participantId].ratingVariation.push(fixed2((side1ConvertedRating - side2ConvertedRating) / highRange));
|
|
20289
|
+
participantResults[side2?.participantId].ratingVariation.push(fixed2((side2ConvertedRating - side1ConvertedRating) / highRange));
|
|
20280
20290
|
}
|
|
20281
20291
|
if (!isTieMatchUp) {
|
|
20282
20292
|
processOutcome$1({
|
|
@@ -57710,6 +57720,7 @@ const POLICY_SCORING_DEFAULT = {
|
|
|
57710
57720
|
},
|
|
57711
57721
|
};
|
|
57712
57722
|
|
|
57723
|
+
const personalCircumstance = 'Personal circumstance';
|
|
57713
57724
|
const POLICY_SCORING_USTA = {
|
|
57714
57725
|
[POLICY_TYPE_SCORING]: {
|
|
57715
57726
|
requireAllPositionsAssigned: false,
|
|
@@ -57902,7 +57913,7 @@ const POLICY_SCORING_USTA = {
|
|
|
57902
57913
|
},
|
|
57903
57914
|
{
|
|
57904
57915
|
matchUpStatusCodeDisplay: 'Wo [pc]',
|
|
57905
|
-
label:
|
|
57916
|
+
label: personalCircumstance,
|
|
57906
57917
|
matchUpStatusCode: 'W3',
|
|
57907
57918
|
},
|
|
57908
57919
|
{
|
|
@@ -57934,7 +57945,7 @@ const POLICY_SCORING_USTA = {
|
|
|
57934
57945
|
},
|
|
57935
57946
|
{
|
|
57936
57947
|
matchUpStatusCodeDisplay: 'Ret [pc]',
|
|
57937
|
-
label:
|
|
57948
|
+
label: personalCircumstance,
|
|
57938
57949
|
matchUpStatusCode: 'RC',
|
|
57939
57950
|
},
|
|
57940
57951
|
{
|
|
@@ -57964,7 +57975,7 @@ const POLICY_SCORING_USTA = {
|
|
|
57964
57975
|
},
|
|
57965
57976
|
{
|
|
57966
57977
|
matchUpStatusCodeDisplay: 'Wd [pc]',
|
|
57967
|
-
label:
|
|
57978
|
+
label: personalCircumstance,
|
|
57968
57979
|
matchUpStatusCode: 'WD.PC',
|
|
57969
57980
|
},
|
|
57970
57981
|
{
|