@rasifix/orienteering-utils 2.0.72 → 2.0.74

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.
@@ -92,7 +92,7 @@ var SolvFormat = /** @class */ (function () {
92
92
  }
93
93
  runner.splits.push({ code: tokens[i_1], time: time });
94
94
  }
95
- runner.splits.push({ code: "Zi", time: runner.time });
95
+ runner.splits.push({ code: "Zi", time: (0, time_1.parseTime)(runner.time) ? runner.time : undefined });
96
96
  category.runners.push(runner);
97
97
  });
98
98
  return {
@@ -184,18 +184,19 @@ function parseRanking(runners) {
184
184
  return;
185
185
  }
186
186
  var rank = 1;
187
- var lastTime = times[0].time;
187
+ var fastestTime = times[0].time;
188
+ var lastTime = fastestTime;
189
+ var idealSplitTime = times.slice(0, 5).reduce(function (sum, t) { return sum + t.time; }, 0) / Math.min(5, times.length);
188
190
  for (var idx = 0; idx < times.length; idx++) {
189
191
  var entry = times[idx];
190
192
  if (lastTime < entry.time) {
191
193
  rank++;
192
194
  }
193
195
  if (runner.id === entry.id) {
194
- var idealSplitTime = times.slice(0, 5).reduce(function (sum, t) { return sum + t.time; }, 0) / Math.min(5, times.length);
195
- var fastestTime = times[0].time;
196
196
  split.overall.rank = rank;
197
197
  split.overall.behind = entry.time - fastestTime;
198
- split.overall.idealBehind = Math.round(entry.time - idealSplitTime);
198
+ var prevIdealBehind = idx > 0 && runner.splits[idx - 1] ? (runner.splits[idx - 1].overall.idealBehind || 0) : 0;
199
+ split.overall.idealBehind = prevIdealBehind + split.leg.idealBehind;
199
200
  break;
200
201
  }
201
202
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rasifix/orienteering-utils",
3
- "version": "2.0.72",
3
+ "version": "2.0.74",
4
4
  "description": "utility functions for orienteering result analyzis",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",