Closed sweep-ai[bot] closed 1 year ago
Enabled Vote Button for On-going Ballots The update permits users to vote in ongoing ballots by enabling the vote button. This is handled in the client interface, specifically in the ballot section.
Introduced Method to Verify Ballot's Status A new procedure is incorporated to determine if a ballot has terminated or not. This methodology assists in ensuring that votes are cast only in the suitable and valid time frame.
Sweep: Could you also add a status to the ballot page please? The status should depend on the new has_ended
and be coloured depending on status. Thank you
Sweep: Could you also add a status to the ballot page please? The status should depend on the new
has_ended
and be coloured depending on status. Thank you
Hi @theref,
I decided to make the following changes:
File Path | Proposed Changes |
---|---|
client_code/forms/routes/ballot/Read/__init__.py |
Modify client_code/forms/routes/ballot/Read/init.py with contents: • Add a new label component to the ballot page to display the status. Name this label as status_label .• In the __init__ method, after the line where the vote button is enabled or disabled, add a condition to check the has_ended method of the ballot.• If the has_ended method returns True, set the text of the status_label to "Ended" and its color to red.• If the has_ended method returns False, set the text of the status_label to "Ongoing" and its color to green. |
Description
This PR adds functionality to prevent users from submitting votes after the end time of a ballot in the Electora decentralized voting application. The Cast Vote Button will be disabled when the ballot's
ends_at
time has passed.Summary of Changes
has_ended
in theBallot
class inclient_code/model.py
to check if the ballot has ended.Read
class inclient_code/forms/routes/ballot/Read/__init__.py
to call thehas_ended
method and disable the vote button based on the ballot's end time.Please review and merge this PR to prevent users from casting votes after the end time of a ballot.
Fixes #92.
To checkout this PR branch, run the following command in your terminal:
🎉 Latest improvements to Sweep:
💡 To get Sweep to edit this pull request, you can: