Skip to content

Commit

Permalink
Fix error when a tie occurs
Browse files Browse the repository at this point in the history
  • Loading branch information
theodorejb committed Apr 5, 2023
1 parent 49ed325 commit 5d79047
Show file tree
Hide file tree
Showing 3 changed files with 782 additions and 0 deletions.
4 changes: 4 additions & 0 deletions php/StvElection.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,10 @@ public function runElection(): array
}
}

if (count($baseTally) === 0) {
break; // there was a tie
}

$round = new ElectionRound($roundNum, $ballots, $baseTally, $allElected, $allEliminated, $this);
$pastRounds[] = $round;
$elected = $round->elected;
Expand Down

0 comments on commit 5d79047

Please sign in to comment.