tods-competition-factory 2.0.52 → 2.0.54

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.
@@ -11045,6 +11045,12 @@ declare const requestConstants: {
11045
11045
  DO_NOT_SCHEDULE: string;
11046
11046
  };
11047
11047
 
11048
+ declare const resourceContants: {
11049
+ RESOURCE_SUB_TYPE: string;
11050
+ RESOURCE_TYPE: string;
11051
+ IDENTIFIER: string;
11052
+ };
11053
+
11048
11054
  declare const resultConstants: {
11049
11055
  SUCCESS: {
11050
11056
  success: boolean;
@@ -11249,6 +11255,7 @@ declare const index_positionActionConstants: typeof positionActionConstants;
11249
11255
  declare const index_ratingConstants: typeof ratingConstants;
11250
11256
  declare const index_recoveryTimeRequiredMatchUpStatuses: typeof recoveryTimeRequiredMatchUpStatuses;
11251
11257
  declare const index_requestConstants: typeof requestConstants;
11258
+ declare const index_resourceContants: typeof resourceContants;
11252
11259
  declare const index_resultConstants: typeof resultConstants;
11253
11260
  declare const index_scaleConstants: typeof scaleConstants;
11254
11261
  declare const index_scheduleConstants: typeof scheduleConstants;
@@ -11262,7 +11269,7 @@ declare const index_upcomingMatchUpStatuses: typeof upcomingMatchUpStatuses;
11262
11269
  declare const index_validMatchUpStatuses: typeof validMatchUpStatuses;
11263
11270
  declare const index_venueConstants: typeof venueConstants;
11264
11271
  declare namespace index {
11265
- export { index_activeMatchUpStatuses as activeMatchUpStatuses, index_auditConstants as auditConstants, index_completedMatchUpStatuses as completedMatchUpStatuses, index_directingMatchUpStatuses as directingMatchUpStatuses, index_drawDefinitionConstants as drawDefinitionConstants, index_entryStatusConstants as entryStatusConstants, index_errorConditionConstants as errorConditionConstants, index_eventConstants as eventConstants, index_extensionConstants as extensionConstants, index_flightConstants as flightConstants, index_genderConstants as genderConstants, index_keyValueConstants as keyValueConstants, index_matchUpActionConstants as matchUpActionConstants, index_matchUpStatusConstants as matchUpStatusConstants, index_matchUpTypes as matchUpTypes, index_nonDirectingMatchUpStatuses as nonDirectingMatchUpStatuses, index_particicipantsRequiredMatchUpStatuses as particicipantsRequiredMatchUpStatuses, index_participantConstants as participantConstants, index_participantRoles as participantRoles, index_participantTypes as participantTypes, index_penaltyConstants as penaltyConstants, index_policyConstants as policyConstants, index_positionActionConstants as positionActionConstants, index_ratingConstants as ratingConstants, index_recoveryTimeRequiredMatchUpStatuses as recoveryTimeRequiredMatchUpStatuses, index_requestConstants as requestConstants, index_resultConstants as resultConstants, index_scaleConstants as scaleConstants, index_scheduleConstants as scheduleConstants, index_sortingConstants as sortingConstants, index_surfaceConstants as surfaceConstants, index_tieFormatConstants as tieFormatConstants, index_timeItemConstants as timeItemConstants, index_topicConstants as topicConstants, index_tournamentConstants as tournamentConstants, index_upcomingMatchUpStatuses as upcomingMatchUpStatuses, index_validMatchUpStatuses as validMatchUpStatuses, index_venueConstants as venueConstants };
11272
+ export { index_activeMatchUpStatuses as activeMatchUpStatuses, index_auditConstants as auditConstants, index_completedMatchUpStatuses as completedMatchUpStatuses, index_directingMatchUpStatuses as directingMatchUpStatuses, index_drawDefinitionConstants as drawDefinitionConstants, index_entryStatusConstants as entryStatusConstants, index_errorConditionConstants as errorConditionConstants, index_eventConstants as eventConstants, index_extensionConstants as extensionConstants, index_flightConstants as flightConstants, index_genderConstants as genderConstants, index_keyValueConstants as keyValueConstants, index_matchUpActionConstants as matchUpActionConstants, index_matchUpStatusConstants as matchUpStatusConstants, index_matchUpTypes as matchUpTypes, index_nonDirectingMatchUpStatuses as nonDirectingMatchUpStatuses, index_particicipantsRequiredMatchUpStatuses as particicipantsRequiredMatchUpStatuses, index_participantConstants as participantConstants, index_participantRoles as participantRoles, index_participantTypes as participantTypes, index_penaltyConstants as penaltyConstants, index_policyConstants as policyConstants, index_positionActionConstants as positionActionConstants, index_ratingConstants as ratingConstants, index_recoveryTimeRequiredMatchUpStatuses as recoveryTimeRequiredMatchUpStatuses, index_requestConstants as requestConstants, index_resourceContants as resourceContants, index_resultConstants as resultConstants, index_scaleConstants as scaleConstants, index_scheduleConstants as scheduleConstants, index_sortingConstants as sortingConstants, index_surfaceConstants as surfaceConstants, index_tieFormatConstants as tieFormatConstants, index_timeItemConstants as timeItemConstants, index_topicConstants as topicConstants, index_tournamentConstants as tournamentConstants, index_upcomingMatchUpStatuses as upcomingMatchUpStatuses, index_validMatchUpStatuses as validMatchUpStatuses, index_venueConstants as venueConstants };
11266
11273
  }
11267
11274
 
11268
- export { activeMatchUpStatuses, askEngine, asyncEngine, auditConstants, competitionEngine, index$k as competitionGovernor, completedMatchUpStatuses, directingMatchUpStatuses, drawDefinitionConstants, index$j as drawsGovernor, index$i as entriesGovernor, entryStatusConstants, errorConditionConstants, eventConstants, index$h as eventGovernor, extensionConstants, index as factoryConstants, fixtures, flightConstants, forge, genderConstants, index$g as generationGovernor, globalState, index$2 as governors, keyValueConstants, matchUpActionConstants, matchUpEngine, index$f as matchUpFormatCode, index$f as matchUpFormatGovernor, index$e as matchUpGovernor, matchUpStatusConstants, matchUpTypes, mocksEngine, index$d as mocksGovernor, nonDirectingMatchUpStatuses, particicipantsRequiredMatchUpStatuses, participantConstants, index$c as participantGovernor, participantRoles, participantTypes, penaltyConstants, policyConstants, index$b as policyGovernor, positionActionConstants, index$a as publishingGovernor, index$9 as queryGovernor, ratingConstants, recoveryTimeRequiredMatchUpStatuses, index$8 as reportGovernor, requestConstants, resultConstants, scaleConstants, scaleEngine, scheduleConstants, index$7 as scheduleGovernor, index$6 as scoreGovernor, sortingConstants, surfaceConstants, syncEngine, tieFormatConstants, index$5 as tieFormatGovernor, timeItemConstants, index$1 as tools, topicConstants, tournamentConstants, tournamentEngine, index$4 as tournamentGovernor, upcomingMatchUpStatuses, index$1 as utilities, validMatchUpStatuses, venueConstants, index$3 as venueGovernor, factoryVersion as version };
11275
+ export { activeMatchUpStatuses, askEngine, asyncEngine, auditConstants, competitionEngine, index$k as competitionGovernor, completedMatchUpStatuses, directingMatchUpStatuses, drawDefinitionConstants, index$j as drawsGovernor, index$i as entriesGovernor, entryStatusConstants, errorConditionConstants, eventConstants, index$h as eventGovernor, extensionConstants, index as factoryConstants, fixtures, flightConstants, forge, genderConstants, index$g as generationGovernor, globalState, index$2 as governors, keyValueConstants, matchUpActionConstants, matchUpEngine, index$f as matchUpFormatCode, index$f as matchUpFormatGovernor, index$e as matchUpGovernor, matchUpStatusConstants, matchUpTypes, mocksEngine, index$d as mocksGovernor, nonDirectingMatchUpStatuses, particicipantsRequiredMatchUpStatuses, participantConstants, index$c as participantGovernor, participantRoles, participantTypes, penaltyConstants, policyConstants, index$b as policyGovernor, positionActionConstants, index$a as publishingGovernor, index$9 as queryGovernor, ratingConstants, recoveryTimeRequiredMatchUpStatuses, index$8 as reportGovernor, requestConstants, resourceContants, resultConstants, scaleConstants, scaleEngine, scheduleConstants, index$7 as scheduleGovernor, index$6 as scoreGovernor, sortingConstants, surfaceConstants, syncEngine, tieFormatConstants, index$5 as tieFormatGovernor, timeItemConstants, index$1 as tools, topicConstants, tournamentConstants, tournamentEngine, index$4 as tournamentGovernor, upcomingMatchUpStatuses, index$1 as utilities, validMatchUpStatuses, venueConstants, index$3 as venueGovernor, factoryVersion as version };
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  function factoryVersion() {
6
- return '2.0.52';
6
+ return '2.0.54';
7
7
  }
8
8
 
9
9
  function isFunction(obj) {
@@ -1786,6 +1786,11 @@ function decorateResult({ context, result, stack, info }) {
1786
1786
  const RESOURCE_SUB_TYPE = 'resourceSubType';
1787
1787
  const RESOURCE_TYPE = 'resourceType';
1788
1788
  const IDENTIFIER = 'identifier';
1789
+ const resourceContants = {
1790
+ RESOURCE_SUB_TYPE,
1791
+ RESOURCE_TYPE,
1792
+ IDENTIFIER,
1793
+ };
1789
1794
 
1790
1795
  const SINGLES$1 = 'SINGLES';
1791
1796
  const SINGLES_EVENT = 'SINGLES';
@@ -19847,8 +19852,8 @@ function calculatePressureRatings({ participantResults, sides, score }) {
19847
19852
  const { convertedRating: side1ConvertedRating } = getConvertedRating({ ratings: side1ratings, targetRatingType });
19848
19853
  const { convertedRating: side2ConvertedRating } = getConvertedRating({ ratings: side2ratings, targetRatingType });
19849
19854
  const { side1pressure, side2pressure } = getSideValues$1({ side1ConvertedRating, side2ConvertedRating, score });
19850
- participantResults[side1?.participantId].pressureScores.push(side1pressure);
19851
- participantResults[side2?.participantId].pressureScores.push(side2pressure);
19855
+ side1pressure && participantResults[side1?.participantId].pressureScores.push(side1pressure);
19856
+ side2pressure && participantResults[side2?.participantId].pressureScores.push(side2pressure);
19852
19857
  const highRange = Math.max(...ratingsParameters[ELO].range);
19853
19858
  const side1Variation = fixedDecimals((side2ConvertedRating - side1ConvertedRating) / highRange);
19854
19859
  const side2Variation = fixedDecimals((side1ConvertedRating - side2ConvertedRating) / highRange);
@@ -19868,11 +19873,11 @@ function getSideValues$1({ side1ConvertedRating, side2ConvertedRating, score })
19868
19873
  const gamesWonSide1 = score?.sets?.reduce((total, set) => total + (set?.side1Score ?? 0), 0);
19869
19874
  const gamesWonSide2 = score?.sets?.reduce((total, set) => total + (set.side2Score ?? 0), 0);
19870
19875
  const lowSide = side1ConvertedRating > side2ConvertedRating ? 2 : 1;
19871
- const side1value = gamesWonSide1 * (lowRating + (lowSide === 1 ? lowSideBump : 0));
19872
- const side2value = gamesWonSide2 * (lowRating + (lowSide === 2 ? lowSideBump : 0));
19876
+ const side1value = (gamesWonSide1 || 0) * (lowRating + (lowSide === 1 ? lowSideBump : 0));
19877
+ const side2value = (gamesWonSide2 || 0) * (lowRating + (lowSide === 2 ? lowSideBump : 0));
19873
19878
  const combinedValues = side1value + side2value;
19874
- const side1pressure = fixedDecimals(side1value / combinedValues);
19875
- const side2pressure = fixedDecimals(side2value / combinedValues);
19879
+ const side1pressure = combinedValues ? fixedDecimals(side1value / combinedValues) : 0;
19880
+ const side2pressure = combinedValues ? fixedDecimals(side2value / combinedValues) : 0;
19876
19881
  return { side1pressure, side2pressure };
19877
19882
  }
19878
19883
 
@@ -20733,6 +20738,8 @@ function tallyParticipantResults({ policyDefinitions, generateReport, pressureRa
20733
20738
  tallyPolicy,
20734
20739
  subOrderMap,
20735
20740
  });
20741
+ if (pressureRating)
20742
+ addPressureOrder({ participantResults });
20736
20743
  if (bracketComplete && groupOrder) {
20737
20744
  report = groupOrderReport;
20738
20745
  order = groupOrder;
@@ -20790,6 +20797,22 @@ function tallyParticipantResults({ policyDefinitions, generateReport, pressureRa
20790
20797
  }
20791
20798
  return result;
20792
20799
  }
20800
+ function addPressureOrder({ participantResults }) {
20801
+ const sum = (values) => values.reduce((total, value) => total + parseFloat(value), 0);
20802
+ const avg = (values) => parseFloat((sum(values) / values.length).toFixed(2));
20803
+ const pressureOrder = Object.keys(participantResults)
20804
+ .map((participantId) => {
20805
+ const participantResult = participantResults[participantId];
20806
+ const { pressureScores } = participantResult;
20807
+ const averagePressure = pressureScores?.length ? avg(pressureScores) : 0;
20808
+ return { participantId, averagePressure };
20809
+ })
20810
+ .sort((a, b) => (b.averagePressure || 0) - (a.averagePressure || 0))
20811
+ .map((results, i) => ({ ...results, order: i + 1 }));
20812
+ for (const item of pressureOrder) {
20813
+ participantResults[item.participantId].pressureOrder = item.order;
20814
+ }
20815
+ }
20793
20816
 
20794
20817
  function createSubOrderMap({ positionAssignments }) {
20795
20818
  const subOrderArray = (positionAssignments || [])
@@ -55460,6 +55483,7 @@ function removeOnlineResource(params) {
55460
55483
  removeResource({ element: tournamentRecord, onlineResource });
55461
55484
  addNotice({
55462
55485
  payload: {
55486
+ parentOrganisation: tournamentRecord.parentOrganisation,
55463
55487
  onlineResources: tournamentRecord.onlineResources,
55464
55488
  tournamentId: tournamentRecord.tournamentId,
55465
55489
  },
@@ -55524,6 +55548,7 @@ function addOnlineResource(params) {
55524
55548
  mergeResource({ element: tournamentRecord, onlineResource });
55525
55549
  addNotice({
55526
55550
  payload: {
55551
+ parentOrganisation: tournamentRecord.parentOrganisation,
55527
55552
  onlineResources: tournamentRecord.onlineResources,
55528
55553
  tournamentId: tournamentRecord.tournamentId,
55529
55554
  },
@@ -58450,6 +58475,7 @@ var index = {
58450
58475
  ratingConstants: ratingConstants,
58451
58476
  recoveryTimeRequiredMatchUpStatuses: recoveryTimeRequiredMatchUpStatuses,
58452
58477
  requestConstants: requestConstants,
58478
+ resourceContants: resourceContants,
58453
58479
  resultConstants: resultConstants,
58454
58480
  scaleConstants: scaleConstants,
58455
58481
  scheduleConstants: scheduleConstants,
@@ -58514,6 +58540,7 @@ exports.ratingConstants = ratingConstants;
58514
58540
  exports.recoveryTimeRequiredMatchUpStatuses = recoveryTimeRequiredMatchUpStatuses;
58515
58541
  exports.reportGovernor = index$6;
58516
58542
  exports.requestConstants = requestConstants;
58543
+ exports.resourceContants = resourceContants;
58517
58544
  exports.resultConstants = resultConstants;
58518
58545
  exports.scaleConstants = scaleConstants;
58519
58546
  exports.scaleEngine = scaleEngine;