@rasifix/orienteering-utils 2.0.66 → 2.0.68

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.
@@ -39,6 +39,8 @@ export interface RankingRunner {
39
39
  course?: string;
40
40
  rank?: number;
41
41
  fullName: string;
42
+ team?: string;
43
+ legOrRun?: number;
42
44
  time?: string;
43
45
  errorTime: string;
44
46
  yearOfBirth?: string;
@@ -29,7 +29,7 @@ function assignLegInfoToSplits(runners, legs) {
29
29
  .forEach(function (split) {
30
30
  var leg = legs[split.legCode];
31
31
  if (!leg) {
32
- throw "leg with code " + split.leg + " not defined!";
32
+ throw "leg with code " + split.legCode + " not defined!";
33
33
  }
34
34
  split.legCode = leg.code;
35
35
  var legRunner = leg.runners.find(function (r) { return r.id === runner.id; });
@@ -287,6 +287,8 @@ function defineRunners(runners) {
287
287
  category: runner.category,
288
288
  rank: undefined,
289
289
  fullName: runner.fullName,
290
+ team: runner.team,
291
+ legOrRun: runner.runOrLeg,
290
292
  time: runner.time,
291
293
  yearOfBirth: runner.yearOfBirth,
292
294
  city: runner.city,
@@ -365,7 +367,6 @@ function defineLegs(runners) {
365
367
  }, {});
366
368
  runners.forEach(function (runner) {
367
369
  runner.splits
368
- //.filter((s) => validTime(s.time))
369
370
  .forEach(function (split, idx) {
370
371
  var from = idx === 0 ? "St" : runner.splits[idx - 1].code;
371
372
  var to = split.code;
@@ -405,6 +406,7 @@ function defineLegProperties(legs) {
405
406
  });
406
407
  // calculate the ideal time: take up to 5 fastest on that leg
407
408
  var selected = leg.runners
409
+ .filter(function (runner) { return runner.split > 0; })
408
410
  .slice(0, Math.min(leg.runners.length, 5))
409
411
  .map(function (runner) { return runner.split; });
410
412
  // only if there are valid splits for this leg
@@ -56,6 +56,7 @@ function parseRelayRanking(runners) {
56
56
  id: firstRunner.id,
57
57
  category: firstRunner.category,
58
58
  fullName: teamRunners.map(function (r) { return r.fullName; }).join(' / '),
59
+ club: teamRunners.map(function (r) { return r.club; }).join(' / '),
59
60
  startTime: firstRunner.startTime,
60
61
  startNumber: startNumber,
61
62
  team: firstRunner.team,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rasifix/orienteering-utils",
3
- "version": "2.0.66",
3
+ "version": "2.0.68",
4
4
  "description": "utility functions for orienteering result analyzis",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",