summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2020-05-14 01:33:53 +0200
committeremkael <emkael@tlen.pl>2020-05-14 01:35:08 +0200
commit1e0b0b0e93ad6efe1d9bfef2e52665f73b17df38 (patch)
tree4998631df0540a7aed84d417fea4cae4dffbaede
parenta649f90765f64392968c4d9bbe08bf9e7668c9e4 (diff)
Skip places with 0 points
-rw-r--r--http/api-inc.php7
1 files 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;
}