From 1e0b0b0e93ad6efe1d9bfef2e52665f73b17df38 Mon Sep 17 00:00:00 2001 From: emkael Date: Thu, 14 May 2020 01:33:53 +0200 Subject: Skip places with 0 points --- http/api-inc.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/http/api-inc.php b/http/api-inc.php index 67a7fd7..1364195 100644 --- a/http/api-inc.php +++ b/http/api-inc.php @@ -200,8 +200,11 @@ class ApiPkl { for ($place = 1; $place <= $this->parameters['contestants']; $place++) { $percentage = $this->get_percentage_from_position($place, $this->parameters['contestants'], $this->parameters['points_cutoffs']); $points = safe_ceil(floatval($max_points) * $percentage * $scale_factor); - $result['points'][$place] = max($min_points, intval($points)); - $result['sum'] += $this->parameters['type'] * $result['points'][$place]; + $points = max($min_points, intval($points)); + if ($points > 0) { + $result['points'][$place] = $points; + $result['sum'] += $this->parameters['type'] * $result['points'][$place]; + } } return $result; } -- cgit v1.2.3