Skip to content

Commit

Permalink
A minor fix to "Guess marks during an event"
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Gruenbacher committed Oct 18, 2020
1 parent 65ff36f commit a4d3073
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions backend/lib/compute_event.js
Expand Up @@ -123,21 +123,23 @@ function compute_event(cached_riders, event, compute_marks) {
});

let average_marks = [];
for (let index in zone_total_marks) {
average_marks[index] =
zone_total_marks[index] / zone_total_riders[index];
for (let index = 0; index < zone_total_riders.length; index++) {
if (zone_total_riders[index]) {
average_marks[index] =
zone_total_marks[index] / zone_total_riders[index];
}
}
return average_marks;
}

function compute_projected_marks(riders, ranking_class) {
let have_unfinished_zones = false;
let compute = false;
riders.forEach((rider) => {
rider.projected_marks = rider.marks;
if (rider.unfinished_zones && !rider.non_competing && !rider.failure)
have_unfinished_zones = true;
compute = true;
});
if (!have_unfinished_zones)
if (!compute)
return;

let average_marks;
Expand Down

0 comments on commit a4d3073

Please sign in to comment.