Skip to content

Commit

Permalink
Make the vote unanimous for the 'qualify' vote
Browse files Browse the repository at this point in the history
  • Loading branch information
loevgaard committed Nov 14, 2023
1 parent 300bbca commit 563e163
Showing 1 changed file with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,13 @@
* NOTICE the following rules apply to the voting process:
*
* 1. Only one voter needs to vote 'disqualify' for the voting to be disqualified
* 2. At least one voter needs to vote 'qualify' for the voting to be qualified
* 2. All voters have to vote 'qualify' for the voting to be qualified
* 3. If none of the above two conditions are met, the voting will be 'abstain'
*/
final class CompositeQualificationVoter extends CompositeService implements QualificationVoterInterface
{
public function vote(ConversionInterface $conversion): Vote
{
$qualify = false;
$reasons = [];

foreach ($this->services as $service) {
Expand All @@ -29,17 +28,13 @@ public function vote(ConversionInterface $conversion): Vote
$reasons[] = $vote->reasons;
}

if ($vote->isDisqualify()) {
if ($vote->isDisqualify() || $vote->isAbstain()) {
return $vote;
}

if ($vote->isQualify()) {
$qualify = true;
}
}

$reasons = array_merge(...$reasons);

return $qualify ? Vote::qualify($reasons) : Vote::abstain($reasons);
return Vote::qualify($reasons);
}
}

0 comments on commit 563e163

Please sign in to comment.