@rasifix/orienteering-utils 2.0.73 → 2.0.75
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.js +4 -4
- package/package.json +1 -1
package/lib/utils/ranking.js
CHANGED
|
@@ -184,18 +184,18 @@ function parseRanking(runners) {
|
|
|
184
184
|
return;
|
|
185
185
|
}
|
|
186
186
|
var rank = 1;
|
|
187
|
-
var
|
|
187
|
+
var fastestTime = times[0].time;
|
|
188
|
+
var lastTime = fastestTime;
|
|
188
189
|
for (var idx = 0; idx < times.length; idx++) {
|
|
189
190
|
var entry = times[idx];
|
|
190
191
|
if (lastTime < entry.time) {
|
|
191
192
|
rank++;
|
|
192
193
|
}
|
|
193
194
|
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
195
|
split.overall.rank = rank;
|
|
197
196
|
split.overall.behind = entry.time - fastestTime;
|
|
198
|
-
|
|
197
|
+
var prevIdealBehind = idx > 0 && runner.splits[idx - 1] ? (runner.splits[idx - 1].overall.idealBehind || 0) : 0;
|
|
198
|
+
split.overall.idealBehind = prevIdealBehind + split.leg.idealBehind;
|
|
199
199
|
break;
|
|
200
200
|
}
|
|
201
201
|
}
|