@rasifix/orienteering-utils 2.0.75 → 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.
- package/lib/utils/ranking.js +2 -2
- package/package.json +1 -1
package/lib/utils/ranking.js
CHANGED
|
@@ -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; })
|
|
@@ -194,7 +194,7 @@ function parseRanking(runners) {
|
|
|
194
194
|
if (runner.id === entry.id) {
|
|
195
195
|
split.overall.rank = rank;
|
|
196
196
|
split.overall.behind = entry.time - fastestTime;
|
|
197
|
-
var prevIdealBehind =
|
|
197
|
+
var prevIdealBehind = splitIdx > 0 ? (runner.splits[splitIdx - 1].overall.idealBehind || 0) : 0;
|
|
198
198
|
split.overall.idealBehind = prevIdealBehind + split.leg.idealBehind;
|
|
199
199
|
break;
|
|
200
200
|
}
|