@rasifix/orienteering-utils 2.0.64 → 2.0.66
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.
|
@@ -48,7 +48,10 @@ var PicoeventsFormat = /** @class */ (function () {
|
|
|
48
48
|
if (tokens.length < 50) {
|
|
49
49
|
return;
|
|
50
50
|
}
|
|
51
|
-
|
|
51
|
+
if (idx === 0) {
|
|
52
|
+
result.relay = tokens[0].endsWith("=R");
|
|
53
|
+
}
|
|
54
|
+
var name = tokens[baseClassIdx];
|
|
52
55
|
if (name.indexOf("TW") !== -1 || name.indexOf("TM") !== -1) {
|
|
53
56
|
return;
|
|
54
57
|
}
|
|
@@ -80,7 +83,6 @@ var PicoeventsFormat = /** @class */ (function () {
|
|
|
80
83
|
startTime: (0, time_1.formatTime)(startTime),
|
|
81
84
|
startNumber: clean(tokens[startNumIdx]),
|
|
82
85
|
runOrLeg: tokens[runOrLegIdx] ? parseInt(tokens[runOrLegIdx]) : undefined,
|
|
83
|
-
baseCategory: clean(tokens[baseClassIdx]),
|
|
84
86
|
team: clean(tokens[teamIdx]),
|
|
85
87
|
splits: [],
|
|
86
88
|
};
|
package/lib/model/runner.d.ts
CHANGED
package/lib/utils/relay.d.ts
CHANGED
|
@@ -4,14 +4,6 @@ export interface Team {
|
|
|
4
4
|
name: string;
|
|
5
5
|
startNumber: number;
|
|
6
6
|
}
|
|
7
|
-
/**
|
|
8
|
-
* Select the runners having the same base category.
|
|
9
|
-
*
|
|
10
|
-
* @param runners all the runners to filter
|
|
11
|
-
* @param category the base category to filter by
|
|
12
|
-
* @returns a filtered list of runners
|
|
13
|
-
*/
|
|
14
|
-
export declare function selectRunnersOfCategory(runners: Runner[], category: string): Runner[];
|
|
15
7
|
/**
|
|
16
8
|
* Extract all unique teams from the given runners.
|
|
17
9
|
*
|
package/lib/utils/relay.js
CHANGED
|
@@ -6,21 +6,10 @@
|
|
|
6
6
|
// e.g. for a 3-leg relay, there will be runners with runOrLeg 1, 2 and 3
|
|
7
7
|
// all runners with runOrLeg 1 belong to the first leg of their team, etc.
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.selectRunnersOfCategory = selectRunnersOfCategory;
|
|
10
9
|
exports.getTeams = getTeams;
|
|
11
10
|
exports.parseRelayRanking = parseRelayRanking;
|
|
12
11
|
var ranking_1 = require("./ranking");
|
|
13
12
|
var time_1 = require("../time");
|
|
14
|
-
/**
|
|
15
|
-
* Select the runners having the same base category.
|
|
16
|
-
*
|
|
17
|
-
* @param runners all the runners to filter
|
|
18
|
-
* @param category the base category to filter by
|
|
19
|
-
* @returns a filtered list of runners
|
|
20
|
-
*/
|
|
21
|
-
function selectRunnersOfCategory(runners, category) {
|
|
22
|
-
return runners.filter(function (runner) { return runner.baseCategory === category; });
|
|
23
|
-
}
|
|
24
13
|
/**
|
|
25
14
|
* Extract all unique teams from the given runners.
|
|
26
15
|
*
|
|
@@ -69,12 +58,12 @@ function parseRelayRanking(runners) {
|
|
|
69
58
|
fullName: teamRunners.map(function (r) { return r.fullName; }).join(' / '),
|
|
70
59
|
startTime: firstRunner.startTime,
|
|
71
60
|
startNumber: startNumber,
|
|
72
|
-
baseCategory: firstRunner.baseCategory,
|
|
73
61
|
team: firstRunner.team,
|
|
74
62
|
splits: []
|
|
75
63
|
};
|
|
76
64
|
// Combine splits from all legs
|
|
77
65
|
var accumulatedTime = 0;
|
|
66
|
+
var previousValid = true;
|
|
78
67
|
teamRunners.forEach(function (runner) {
|
|
79
68
|
runner.splits.forEach(function (split) {
|
|
80
69
|
var splitTime = (0, time_1.parseTime)(split.time);
|
|
@@ -95,9 +84,10 @@ function parseRelayRanking(runners) {
|
|
|
95
84
|
accumulatedTime += runnerTotalTime;
|
|
96
85
|
}
|
|
97
86
|
}
|
|
87
|
+
previousValid = previousValid && (runner.time !== undefined) && (0, time_1.parseTime)(runner.time) !== undefined;
|
|
98
88
|
});
|
|
99
89
|
// Set the final combined time
|
|
100
|
-
combinedRunner.time = (0, time_1.formatTime)(accumulatedTime);
|
|
90
|
+
combinedRunner.time = previousValid ? (0, time_1.formatTime)(accumulatedTime) : "DSQ";
|
|
101
91
|
combinedRunners.push(combinedRunner);
|
|
102
92
|
});
|
|
103
93
|
// Parse the ranking as usual
|