Merge branch 'bugfix/cumulativefix' into develop

This commit is contained in:
Jeroen De Meerleer 2019-06-01 15:44:33 +02:00
commit 5da506b743
Signed by: JeroenED
GPG Key ID: 28CCCB8F62BFADD6

View File

@ -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);
}
}