Skip to content

Commit

Permalink
Optimize InstantRunOff #2
Browse files Browse the repository at this point in the history
  • Loading branch information
julien-boudry committed May 22, 2021
1 parent 7277660 commit dec56a0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/Algo/Methods/InstantRunoff/InstantRunoff.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ protected function makeScore (array $candidateDone) : array
foreach ($oneRank as $oneCandidate) :
if (\count($oneRank) !== 1) :
break;
elseif (!\in_array(needle: $this->_selfElection->getCandidateKey($oneCandidate), haystack: $candidateDone, strict: true)) :
$score[$this->_selfElection->getCandidateKey($oneRank[\array_key_first($oneRank)])] += $weight;
elseif (!\in_array(needle: ($candidateKey = $this->_selfElection->getCandidateKey($oneCandidate)), haystack: $candidateDone, strict: true)) :
$score[$candidateKey] += $weight;
break 2;
endif;
endforeach;
Expand Down

0 comments on commit dec56a0

Please sign in to comment.