@rasifix/orienteering-utils 2.0.74 → 2.0.76

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.
@@ -168,7 +168,7 @@ function parseRanking(runners) {
168
168
  };
169
169
  // now calculate the split ranks and behinds for each split of each runner
170
170
  rankingRunners.forEach(function (runner) {
171
- runner.splits.forEach(function (split) {
171
+ runner.splits.forEach(function (split, splitIdx) {
172
172
  var tap = timesAtPosition(Math.min(1, split.position));
173
173
  var times = tap
174
174
  .filter(function (entry) { return entry.time && entry.time > 0; })
@@ -186,7 +186,6 @@ function parseRanking(runners) {
186
186
  var rank = 1;
187
187
  var fastestTime = times[0].time;
188
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);
190
189
  for (var idx = 0; idx < times.length; idx++) {
191
190
  var entry = times[idx];
192
191
  if (lastTime < entry.time) {
@@ -195,7 +194,7 @@ function parseRanking(runners) {
195
194
  if (runner.id === entry.id) {
196
195
  split.overall.rank = rank;
197
196
  split.overall.behind = entry.time - fastestTime;
198
- var prevIdealBehind = idx > 0 && runner.splits[idx - 1] ? (runner.splits[idx - 1].overall.idealBehind || 0) : 0;
197
+ var prevIdealBehind = splitIdx > 0 ? (runner.splits[splitIdx - 1].overall.idealBehind || 0) : 0;
199
198
  split.overall.idealBehind = prevIdealBehind + split.leg.idealBehind;
200
199
  break;
201
200
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rasifix/orienteering-utils",
3
- "version": "2.0.74",
3
+ "version": "2.0.76",
4
4
  "description": "utility functions for orienteering result analyzis",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",