@rasifix/orienteering-utils 2.0.22 → 2.0.24
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.
- package/lib/utils/ranking.d.ts +1 -0
- package/lib/utils/ranking.js +11 -8
- package/package.json +1 -1
package/lib/utils/ranking.d.ts
CHANGED
package/lib/utils/ranking.js
CHANGED
|
@@ -230,6 +230,7 @@ function defineRunners(runners) {
|
|
|
230
230
|
}
|
|
231
231
|
return {
|
|
232
232
|
id: runner.id,
|
|
233
|
+
category: runner.category,
|
|
233
234
|
rank: undefined,
|
|
234
235
|
fullName: runner.fullName,
|
|
235
236
|
time: runner.time,
|
|
@@ -309,19 +310,21 @@ function defineLegs(runners) {
|
|
|
309
310
|
}, {});
|
|
310
311
|
runners.forEach(function (runner) {
|
|
311
312
|
runner.splits
|
|
313
|
+
//.filter((s) => validTime(s.time))
|
|
312
314
|
.forEach(function (split, idx) {
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
if (validTime(time)) {
|
|
315
|
+
var from = idx === 0 ? "St" : runner.splits[idx - 1].code;
|
|
316
|
+
var to = split.code;
|
|
317
|
+
var code = from + "-" + to;
|
|
318
|
+
var current = legs[code];
|
|
319
|
+
if (validTime(split.time)) {
|
|
319
320
|
current.runners.push({
|
|
320
321
|
id: runner.id,
|
|
321
322
|
fullName: runner.fullName,
|
|
322
323
|
splitRank: 0,
|
|
323
324
|
time: split.time,
|
|
324
|
-
split:
|
|
325
|
+
split: idx === 0
|
|
326
|
+
? split.time
|
|
327
|
+
: split.time - runner.splits[idx - 1].time,
|
|
325
328
|
});
|
|
326
329
|
}
|
|
327
330
|
});
|
|
@@ -346,7 +349,7 @@ function defineLegProperties(legs) {
|
|
|
346
349
|
return r1.split - r2.split;
|
|
347
350
|
});
|
|
348
351
|
// calculate the ideal time: take up to 5 fastest on that leg
|
|
349
|
-
var selected = leg.runners
|
|
352
|
+
var selected = leg.runners
|
|
350
353
|
.slice(0, Math.min(leg.runners.length, 5))
|
|
351
354
|
.map(function (runner) { return runner.split; });
|
|
352
355
|
// only if there are valid splits for this leg
|