From cbf0082b44007b5289b3be6b1e9a2a1840053e04 Mon Sep 17 00:00:00 2001 From: Jeroen De Meerleer Date: Sat, 1 Jun 2019 15:43:22 +0200 Subject: [PATCH] fixed cumulative --- src/Tiebreaks.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Tiebreaks.php b/src/Tiebreaks.php index c3232cd..5328241 100644 --- a/src/Tiebreaks.php +++ b/src/Tiebreaks.php @@ -279,6 +279,7 @@ abstract class Tiebreaks extends Tournament protected function calculateCumulative(Player $player): ?float { $tiebreak = 0; + $score = []; foreach ($player->getPairings() as $pairing) { $toadd = 0; if (array_search($pairing->getResult(), Constants::Won) !== false) { @@ -286,8 +287,9 @@ abstract class Tiebreaks extends Tournament } elseif (array_search($pairing->getResult(), Constants::Draw) !== false) { $toadd = 0.5; } - $tiebreak += $tiebreak + $toadd; + $tiebreak += $toadd; + $score[] = $tiebreak; } - return $tiebreak; + return array_sum($score); } }