tods-competition-factory 1.8.17 → 1.8.18

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.
@@ -2905,7 +2905,7 @@ var matchUpFormatCode = {
2905
2905
  };
2906
2906
 
2907
2907
  function factoryVersion() {
2908
- return '1.8.17';
2908
+ return '1.8.18';
2909
2909
  }
2910
2910
 
2911
2911
  function getObjectTieFormat(obj) {
@@ -17577,8 +17577,8 @@ function allTournamentMatchUps(params) {
17577
17577
  if (!participants) {
17578
17578
  (_a = hydrateParticipants({
17579
17579
  participantsProfile: participantsProfile,
17580
- policyDefinitions: policyDefinitions,
17581
17580
  useParticipantMap: useParticipantMap,
17581
+ policyDefinitions: policyDefinitions,
17582
17582
  tournamentRecord: tournamentRecord,
17583
17583
  contextProfile: contextProfile,
17584
17584
  inContext: inContext,
@@ -57162,16 +57162,6 @@ function getTieMatchUpContext(_a) {
57162
57162
  return __assign({ inContextDualMatchUp: inContextDualMatchUp, inContextTieMatchUp: inContextTieMatchUp, relevantAssignments: relevantAssignments, collectionPosition: collectionPosition, teamParticipants: teamParticipants, collectionId: collectionId, matchUpType: matchUpType, dualMatchUp: dualMatchUp, tieMatchUp: tieMatchUp, tieFormat: tieFormat, structure: structure }, SUCCESS);
57163
57163
  }
57164
57164
 
57165
- /**
57166
- * @param {object} tournamentRecord
57167
- * @param {string} participantId
57168
- * @param {object} drawDefinition
57169
- * @param {string} tieMatchUpId
57170
- * @param {number=} sideNumber
57171
- * @param {string} matchUpId
57172
- * @param {string=} drawId
57173
- * @param {object} event
57174
- */
57175
57165
  function assignTieMatchUpParticipantId(params) {
57176
57166
  var e_1, _a;
57177
57167
  var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
@@ -59255,12 +59245,15 @@ function getEntryStatusReports(_a) {
59255
59245
  function getParticipantStats(_a) {
59256
59246
  var e_1, _b, e_2, _c, e_3, _d, e_4, _e, e_5, _f, e_6, _g, e_7, _h;
59257
59247
  var _j, _k, _l, _m, _o, _p;
59258
- var withCompetitiveProfiles = _a.withCompetitiveProfiles, opponentParticipantId = _a.opponentParticipantId, withIndividualStats = _a.withIndividualStats, teamParticipantId = _a.teamParticipantId, tournamentRecord = _a.tournamentRecord, tallyPolicy = _a.tallyPolicy, matchUps = _a.matchUps;
59248
+ var withCompetitiveProfiles = _a.withCompetitiveProfiles, opponentParticipantId = _a.opponentParticipantId, withIndividualStats = _a.withIndividualStats, teamParticipantId = _a.teamParticipantId, tournamentRecord = _a.tournamentRecord, withScaleValues = _a.withScaleValues, tallyPolicy = _a.tallyPolicy, matchUps = _a.matchUps;
59259
59249
  if (!tournamentRecord)
59260
59250
  return { error: MISSING_TOURNAMENT_RECORD };
59261
59251
  if (matchUps && !Array.isArray(matchUps))
59262
59252
  return { error: INVALID_MATCHUP };
59263
- matchUps = matchUps || allTournamentMatchUps({ tournamentRecord: tournamentRecord }).matchUps;
59253
+ var participantsProfile = withScaleValues ? { withScaleValues: withScaleValues } : undefined;
59254
+ matchUps =
59255
+ matchUps ||
59256
+ allTournamentMatchUps({ tournamentRecord: tournamentRecord, participantsProfile: participantsProfile }).matchUps;
59264
59257
  if (!(matchUps === null || matchUps === void 0 ? void 0 : matchUps.length))
59265
59258
  return { error: MISSING_MATCHUPS };
59266
59259
  var teamParticipantIds = [];
@@ -59280,8 +59273,8 @@ function getParticipantStats(_a) {
59280
59273
  }
59281
59274
  if (!teamParticipantIds.length)
59282
59275
  teamParticipantIds.push.apply(teamParticipantIds, __spreadArray([], __read(teamParticipants.map(extractAttributes('participantId'))), false));
59276
+ var participantDetails = new Map();
59283
59277
  var participantStats = new Map();
59284
- var participantNameMap = new Map();
59285
59278
  var participating = new Map();
59286
59279
  var teamMap = new Map();
59287
59280
  var initStats = function (participantId, participantName) {
@@ -59329,13 +59322,17 @@ function getParticipantStats(_a) {
59329
59322
  var relevantMatchUps = [];
59330
59323
  var getSideParticipantIds = function (sides) {
59331
59324
  var e_8, _a, e_9, _b, e_10, _c;
59332
- var _d;
59333
59325
  var sideParticipantIds = [[], []];
59334
59326
  try {
59335
59327
  for (var sides_1 = __values(sides), sides_1_1 = sides_1.next(); !sides_1_1.done; sides_1_1 = sides_1.next()) {
59336
59328
  var side = sides_1_1.value;
59337
- if ((_d = side.participant) === null || _d === void 0 ? void 0 : _d.participantName)
59338
- participantNameMap.set(side.participant.participantId, side.participant.participantName);
59329
+ var participant = side.participant;
59330
+ if (participant === null || participant === void 0 ? void 0 : participant.participantName) {
59331
+ participantDetails.set(participant.participantId, {
59332
+ participantName: participant.participantName,
59333
+ ratings: participant.ratings,
59334
+ });
59335
+ }
59339
59336
  }
59340
59337
  }
59341
59338
  catch (e_8_1) { e_8 = { error: e_8_1 }; }
@@ -59423,7 +59420,7 @@ function getParticipantStats(_a) {
59423
59420
  else {
59424
59421
  try {
59425
59422
  for (var teamMap_1 = __values(teamMap), teamMap_1_1 = teamMap_1.next(); !teamMap_1_1.done; teamMap_1_1 = teamMap_1.next()) {
59426
- var _e = __read(teamMap_1_1.value, 2), thisTeamId = _e[0], individualParticipantIds = _e[1];
59423
+ var _d = __read(teamMap_1_1.value, 2), thisTeamId = _d[0], individualParticipantIds = _d[1];
59427
59424
  processSides(thisTeamId, individualParticipantIds);
59428
59425
  }
59429
59426
  }
@@ -59499,8 +59496,10 @@ function getParticipantStats(_a) {
59499
59496
  }), pointsTally = _v.pointsTally, tiebreaksTally = _v.tiebreaksTally;
59500
59497
  sideParticipantIds.forEach(function (ids, index) {
59501
59498
  var e_13, _a;
59499
+ var _b;
59502
59500
  var _loop_2 = function (id) {
59503
- var stats = initStats(id, participantNameMap.get(id));
59501
+ var participantName = (_b = participantDetails.get(id)) === null || _b === void 0 ? void 0 : _b.participantName;
59502
+ var stats = initStats(id, participantName);
59504
59503
  if (stats) {
59505
59504
  var teamSumTally = function (stat, tally) {
59506
59505
  return tally.forEach(function (t, i) { return (stats[stat][i] += t); });
@@ -65360,17 +65359,18 @@ function getEvents(_a) {
65360
65359
  var _c, _d, _e;
65361
65360
  var processParticipant = function (participant) {
65362
65361
  var e_12, _a;
65363
- var _b, _c, _d, _e, _f;
65364
- if ((_b = participant === null || participant === void 0 ? void 0 : participant.ratings) === null || _b === void 0 ? void 0 : _b[eventType]) {
65362
+ var _b, _c, _d, _e, _f, _g, _h;
65363
+ if (((_b = eventsMap[eventId].draws) === null || _b === void 0 ? void 0 : _b[drawId]) &&
65364
+ ((_c = participant === null || participant === void 0 ? void 0 : participant.ratings) === null || _c === void 0 ? void 0 : _c[eventType])) {
65365
65365
  try {
65366
- for (var _g = (e_12 = void 0, __values((_d = (_c = participant === null || participant === void 0 ? void 0 : participant.ratings) === null || _c === void 0 ? void 0 : _c[eventType]) !== null && _d !== void 0 ? _d : [])), _h = _g.next(); !_h.done; _h = _g.next()) {
65367
- var rating = _h.value;
65366
+ for (var _j = (e_12 = void 0, __values((_e = (_d = participant === null || participant === void 0 ? void 0 : participant.ratings) === null || _d === void 0 ? void 0 : _d[eventType]) !== null && _e !== void 0 ? _e : [])), _k = _j.next(); !_k.done; _k = _j.next()) {
65367
+ var rating = _k.value;
65368
65368
  var scaleName = rating.scaleName;
65369
- if (!eventsMap[eventId].draws[drawId].ratings[scaleName])
65369
+ if (!((_f = eventsMap[eventId].draws[drawId]) === null || _f === void 0 ? void 0 : _f.ratings[scaleName]))
65370
65370
  eventsMap[eventId].draws[drawId].ratings[scaleName] = [];
65371
- var accessor = (_e = ratingsParameters[scaleName]) === null || _e === void 0 ? void 0 : _e.accessor;
65371
+ var accessor = (_g = ratingsParameters[scaleName]) === null || _g === void 0 ? void 0 : _g.accessor;
65372
65372
  if (accessor) {
65373
- var value = parseFloat((_f = rating.scaleValue) === null || _f === void 0 ? void 0 : _f[accessor]);
65373
+ var value = parseFloat((_h = rating.scaleValue) === null || _h === void 0 ? void 0 : _h[accessor]);
65374
65374
  if (value) {
65375
65375
  eventsMap[eventId].draws[drawId].ratings[scaleName].push(value);
65376
65376
  }
@@ -65380,7 +65380,7 @@ function getEvents(_a) {
65380
65380
  catch (e_12_1) { e_12 = { error: e_12_1 }; }
65381
65381
  finally {
65382
65382
  try {
65383
- if (_h && !_h.done && (_a = _g.return)) _a.call(_g);
65383
+ if (_k && !_k.done && (_a = _j.return)) _a.call(_j);
65384
65384
  }
65385
65385
  finally { if (e_12) throw e_12.error; }
65386
65386
  }