Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Handle Multiple Winners in Election Results #19

Closed
a-singh09 opened this issue Mar 17, 2024 · 0 comments
Closed

Bug: Handle Multiple Winners in Election Results #19

a-singh09 opened this issue Mar 17, 2024 · 0 comments

Comments

@a-singh09
Copy link

Description:

As per the contract GeneralElections.sol, if a candidate receives more than half of the total votes, they are the sole winner. If no candidate receives more than half of the total votes, all candidates with the highest number of votes are considered winners.

The problem is in the latter part. Currently, the application logs all the winners of an election but only stores the first winner in the _winnerDetails array. This means that if there are multiple winners, only the first one is considered by the application and is declared as the winner.

Problem:

This could lead to incorrect results in elections where there are multiple winners. For example, in a tied election where there are two or more winners, only the first winner is stored and considered by the application.

Steps to Reproduce:

  1. Conduct an election where there are multiple winners.
  2. Observe the winner after the election. The candidate who has higher ranked id will be shown as winner, but in actual, both should be declared as winners.

Expected Result:

All winners should be stored in the _winnerDetails array and considered by the application.

Actual Result:

Only the first winner is stored in the _winnerDetails array and considered by the application.

Proposed Solution:

Modify the code to store all winners in the _winnerDetails array and show them as winners

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants