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

Enhancement: Add Candidate Prompt or Warning for Election Creation to Prevent Immediate Election Start Without Candidates #73

Open
zain171m opened this issue Oct 17, 2024 · 11 comments
Assignees

Comments

@zain171m
Copy link

Context:

When creating an election in Agora Blockchain web app, the user is asked to set a start and end date/time but not to add candidates initially. If the user sets the start time to the current time, the election begins immediately, preventing further addition of candidates.

Problem:

I set the election start time to the current time, thinking I could add candidates later. The election started automatically, and I couldn't add any candidates.

Proposed Enhancement:

  • Option 1: Allow users to add candidates during election creation before starting the election.
  • Option 2: Add a warning message if the start time is set to the current time, informing users to add candidates beforehand.

Expected Outcome:

This change would improve the user experience by preventing accidental election starts without candidates.

Suggested Labels:

  • enhancement
  • UX
  • help wanted

Screenshots:

Current Election Creation UI:
image

@shreyam7713
Copy link

Hi @zain171m , I would like to work on this issue. Could you please Assign me this issue.

@Shri1927
Copy link

Hi @zain171m , Can you please assign me this issue

@SachinSaiTej
Copy link

SachinSaiTej commented Oct 30, 2024

Hi @Ronnieraj37, I would like to work on this issue. Could you please assign me this issue.

@Ronnieraj37
Copy link
Contributor

Ronnieraj37 commented Oct 30, 2024

Hey @zain171m Pl add in more details on how you would implement Option 1. Will this include doing it from the blockchain contracts side as well? @shreyam7713 @Shri1927 @SachinSaiTej Please give your reviews as well.

@SachinSaiTej
Copy link

i think we should add a condition to check the number of candidates to be alteast 2 before starting the election. Voting for a single item/member doesnot make any sense as the result will always be unanimous and same.

@zain171m
Copy link
Author

@Ronnieraj37 There could be multiple ways to tackle this issue. We can pass candidates as parameters at the time we create election.

@ANKITSINGH065
Copy link

you’d modify the election creation process so that users are required to add candidates before setting the election start time. This ensures that the election will have candidates when it begins, preventing the issue of starting an election with no candidates.

@zain171m

@ANKITSINGH065
Copy link

and the second solution
display a warning message if a user tries to set the start time to the current time. This message would alert users that the election will begin immediately and they won’t be able to add candidates afterward. This way, users can either choose to delay the start time or add candidates first.

@zain171m

@Neurvinch
Copy link

@Ronnieraj37 I would like to work on this issue. Could you please assign me this issue. This will boost my responsiblity

@rairohit17
Copy link

rairohit17 commented Dec 27, 2024

@Ronnieraj37 here is the complete POC for this issue
we can add a option add candidates and also option to remove them while creating an election
i have implemented this in the below snippet

Screen.Recording.2024-12-27.153812.mp4

while creating an election we would pass the candidates as arguments in createElection() function
candidates.map((candidate) => ({
name: candidate.name,
description: candidate.description,
})),
at the contract level we would simply declare a candidate[] array in the initialize function and push it in our original candidates array

@Ronnieraj37
Copy link
Contributor

Hey @zain171m and @rairohit17 your solution looks good. Also what if user add 2 candidates while creating and removes them before the election starts? Do you suggest we should have something for that as well?

@zain171m and @rairohit17 can you guys work together as @rairohit17 has already made the frontend changes we can use it after changes are pushed from @zain171m ?

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

8 participants