electora-vote / electora-app

Decentralized Voting Application - leveraging the power of zk-proofs, conditions based decryption, and decentralized storage
https://app.electora.eu/
8 stars 2 forks source link

Prevent users from submitting votes after the endtime and add status indicator to ballot page #95

Closed sweep-ai[bot] closed 1 year ago

sweep-ai[bot] commented 1 year ago

Description

This PR addresses the following issues:

Summary of Changes

Testing

Screenshots

Checklist

Fixes #92.


To checkout this PR branch, run the following command in your terminal:

git checkout sweep/prevent-votes-after-endtime

šŸŽ‰ Latest improvements to Sweep:


šŸ’” To get Sweep to edit this pull request, you can:

what-the-diff[bot] commented 1 year ago

PR Summary

sweep-ai[bot] commented 1 year ago

GitHub actions yielded the following error.

##[group]Run python -m black --check .
python -m black --check .
shell: /usr/bin/bash -e {0}
env:
pythonLocation: /opt/hostedtoolcache/Python/3.7.17/x64
PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.7.17/x64/lib/pkgconfig
Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.7.17/x64
Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.7.17/x64
Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.7.17/x64
LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.7.17/x64/lib
##[endgroup]
would reformat /home/runner/work/electora-app/electora-app/client_code/forms/routes/ballot/Read/__init__.py

Oh no! šŸ’„ šŸ’” šŸ’„
1 file would be reformatted, 26 files would be left unchanged.
##[error]Process completed with exit code 1.

The command that failed is python -m black --check ..

There are a lot of errors. This is likely due to a small parsing issue or a missing import with the files changed in the PR.

This is likely a linting or type-checking issue with the source code. Update the code changed by the PR. Don't modify the existing tests.

sweep-ai[bot] commented 1 year ago

šŸš€ Wrote Changes

##[group]Run python -m black --check .
python -m black --check .
shell: /usr/bin/bash -e {0}
env:
pythonLocation: /opt/hostedtoolcache/Python/3.7.17/x64
PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.7.17/x64/lib/pkgconfig
Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.7.17/x64
Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.7.17/x64
Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.7.17/x64
LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.7.17/x64/lib
##[endgroup]
would reformat /home/runner/work/electora-app/electora-app/client_code/forms/routes/ballot/Read/__init__.py

Oh no! šŸ’„ šŸ’” šŸ’„
1 file would be reformatted, 26 files would be left unchanged.
##[error]Process completed with exit code 1.

The command that failed is python -m black --check ..

There are a lot of errors. This is likely due to a small parsing issue or a missing import with the files changed in the PR.

Hi @sweep-ai[bot],

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:
ā€¢ Review the changes made to the file in the pull request and identify any formatting issues.
ā€¢ Correct any identified formatting issues. This could involve adjusting indentation, adding or removing whitespace, or making other formatting changes to adhere to PEP 8 style guidelines.
ā€¢ Run Black on the file to ensure it passes the formatting check.
sweep-ai[bot] commented 1 year ago

GitHub actions yielded the following error.

##[group]Run python -m black --check .
python -m black --check .
shell: /usr/bin/bash -e {0}
env:
pythonLocation: /opt/hostedtoolcache/Python/3.7.17/x64
PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.7.17/x64/lib/pkgconfig
Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.7.17/x64
Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.7.17/x64
Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.7.17/x64
LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.7.17/x64/lib
##[endgroup]
would reformat /home/runner/work/electora-app/electora-app/client_code/forms/routes/ballot/Read/__init__.py

Oh no! šŸ’„ šŸ’” šŸ’„
1 file would be reformatted, 26 files would be left unchanged.
##[error]Process completed with exit code 1.

The command that failed is python -m black --check ..

There are a lot of errors. This is likely due to a small parsing issue or a missing import with the files changed in the PR.

This is likely a linting or type-checking issue with the source code. Update the code changed by the PR. Don't modify the existing tests.

sweep-ai[bot] commented 1 year ago

šŸš€ Wrote Changes

##[group]Run python -m black --check .
python -m black --check .
shell: /usr/bin/bash -e {0}
env:
pythonLocation: /opt/hostedtoolcache/Python/3.7.17/x64
PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.7.17/x64/lib/pkgconfig
Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.7.17/x64
Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.7.17/x64
Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.7.17/x64
LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.7.17/x64/lib
##[endgroup]
would reformat /home/runner/work/electora-app/electora-app/client_code/forms/routes/ballot/Read/__init__.py

Oh no! šŸ’„ šŸ’” šŸ’„
1 file would be reformatted, 26 files would be left unchanged.
##[error]Process completed with exit code 1.

The command that failed is python -m black --check ..

There are a lot of errors. This is likely due to a small parsing issue or a missing import with the files changed in the PR.

Hi @sweep-ai[bot],

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:
ā€¢ Run the file through the Black code formatter to ensure it adheres to PEP 8 style guidelines.
ā€¢ Review the changes made by Black to ensure they do not affect the functionality of the code.
sweep-ai[bot] commented 1 year ago

GitHub actions yielded the following error.

##[group]Run python -m black --check .
python -m black --check .
shell: /usr/bin/bash -e {0}
env:
pythonLocation: /opt/hostedtoolcache/Python/3.7.17/x64
PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.7.17/x64/lib/pkgconfig
Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.7.17/x64
Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.7.17/x64
Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.7.17/x64
LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.7.17/x64/lib
##[endgroup]
would reformat /home/runner/work/electora-app/electora-app/client_code/forms/routes/ballot/Read/__init__.py

Oh no! šŸ’„ šŸ’” šŸ’„
1 file would be reformatted, 26 files would be left unchanged.
##[error]Process completed with exit code 1.

The command that failed is python -m black --check ..

There are a lot of errors. This is likely due to a small parsing issue or a missing import with the files changed in the PR.

This is likely a linting or type-checking issue with the source code. Update the code changed by the PR. Don't modify the existing tests.

sweep-ai[bot] commented 1 year ago

GitHub actions yielded the following error.

##[group]Run python -m black --check .
python -m black --check .
shell: /usr/bin/bash -e {0}
env:
pythonLocation: /opt/hostedtoolcache/Python/3.7.17/x64
PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.7.17/x64/lib/pkgconfig
Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.7.17/x64
Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.7.17/x64
Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.7.17/x64
LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.7.17/x64/lib
##[endgroup]
would reformat /home/runner/work/electora-app/electora-app/client_code/forms/routes/ballot/Read/__init__.py

Oh no! šŸ’„ šŸ’” šŸ’„
1 file would be reformatted, 26 files would be left unchanged.
##[error]Process completed with exit code 1.

The command that failed is python -m black --check ..

There are a lot of errors. This is likely due to a small parsing issue or a missing import with the files changed in the PR.

This is likely a linting or type-checking issue with the source code. Update the code changed by the PR. Don't modify the existing tests.

sweep-ai[bot] commented 1 year ago

šŸš€ Wrote Changes

##[group]Run python -m black --check .
python -m black --check .
shell: /usr/bin/bash -e {0}
env:
pythonLocation: /opt/hostedtoolcache/Python/3.7.17/x64
PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.7.17/x64/lib/pkgconfig
Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.7.17/x64
Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.7.17/x64
Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.7.17/x64
LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.7.17/x64/lib
##[endgroup]
would reformat /home/runner/work/electora-app/electora-app/client_code/forms/routes/ballot/Read/__init__.py

Oh no! šŸ’„ šŸ’” šŸ’„
1 file would be reformatted, 26 files would be left unchanged.
##[error]Process completed with exit code 1.

The command that failed is python -m black --check ..

There are a lot of errors. This is likely due to a small parsing issue or a missing import with the files changed in the PR.

Hi @sweep-ai[bot],

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:
ā€¢ Reformat the entire file using Black to ensure that it adheres to PEP 8.
sweep-ai[bot] commented 1 year ago

šŸš€ Wrote Changes

##[group]Run python -m black --check .
python -m black --check .
shell: /usr/bin/bash -e {0}
env:
pythonLocation: /opt/hostedtoolcache/Python/3.7.17/x64
PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.7.17/x64/lib/pkgconfig
Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.7.17/x64
Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.7.17/x64
Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.7.17/x64
LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.7.17/x64/lib
##[endgroup]
would reformat /home/runner/work/electora-app/electora-app/client_code/forms/routes/ballot/Read/__init__.py

Oh no! šŸ’„ šŸ’” šŸ’„
1 file would be reformatted, 26 files would be left unchanged.
##[error]Process completed with exit code 1.

The command that failed is python -m black --check ..

There are a lot of errors. This is likely due to a small parsing issue or a missing import with the files changed in the PR.

Hi @sweep-ai[bot],

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:
ā€¢ Run Black on the file to automatically reformat the code according to the formatting rules enforced by Black.
ā€¢ Review the changes made by Black to ensure they do not affect the functionality of the code.
ā€¢ Commit the reformatted file.
sweep-ai[bot] commented 1 year ago

GitHub actions yielded the following error.

error: cannot format /home/runner/work/electora-app/electora-app/client_code/forms/routes/ballot/Read/__init__.py: Cannot parse: 1:9: {updated lines after running Black}

Oh no! šŸ’„ šŸ’” šŸ’„
26 files would be left unchanged, 1 file would fail to reformat.

The command that failed is python -m black --check ..

This is likely a linting or type-checking issue with the source code. Update the code changed by the PR. Don't modify the existing tests.

sweep-ai[bot] commented 1 year ago

GitHub actions yielded the following error.

error: cannot format /home/runner/work/electora-app/electora-app/client_code/forms/routes/ballot/Read/__init__.py: Cannot parse: 1:9: {updated lines after running Black}

Oh no! šŸ’„ šŸ’” šŸ’„
26 files would be left unchanged, 1 file would fail to reformat.

The command that failed is python -m black --check ..

This is likely a linting or type-checking issue with the source code. Update the code changed by the PR. Don't modify the existing tests.

sweep-ai[bot] commented 1 year ago

šŸš€ Wrote Changes

error: cannot format /home/runner/work/electora-app/electora-app/client_code/forms/routes/ballot/Read/__init__.py: Cannot parse: 1:9: {updated lines after running Black}

Oh no! šŸ’„ šŸ’” šŸ’„
26 files would be left unchanged, 1 file would fail to reformat.

The command that failed is python -m black --check ..

Hi @sweep-ai[bot],

I decided to make the following changes:

File Path Proposed Changes
client_code/forms/routes/ballot/Read/__init__.py Rewrite client_code/forms/routes/ballot/Read/init.py with contents:
ā€¢ Replace the placeholder {updated lines after running Black} with the actual Python code that was intended to be there. This code should define the Read class and its methods, as per the original version of the file.
ā€¢ Ensure that the new method update_status is correctly implemented. This method should update the status of the ballot based on the current time and the ends_at attribute of the ballot. It should also update the enabled state of the "Cast Vote" button.
ā€¢ Call the update_status method in the __init__ method to ensure the status is updated whenever the ballot page is loaded.
sweep-ai[bot] commented 1 year ago

šŸš€ Wrote Changes

error: cannot format /home/runner/work/electora-app/electora-app/client_code/forms/routes/ballot/Read/__init__.py: Cannot parse: 1:9: {updated lines after running Black}

Oh no! šŸ’„ šŸ’” šŸ’„
26 files would be left unchanged, 1 file would fail to reformat.

The command that failed is python -m black --check ..

Hi @sweep-ai[bot],

I decided to make the following changes:

File Path Proposed Changes
client_code/forms/routes/ballot/Read/__init__.py Rewrite client_code/forms/routes/ballot/Read/init.py with contents:
ā€¢ Import the necessary modules at the top of the file.
ā€¢ Define the Read class that inherits from ReadTemplate.
ā€¢ In the __init__ method of the Read class, initialize the ballot and item attributes, set the explorer_link.url attribute, and call the init_components method with the provided properties.
ā€¢ Add a hide_button_click method to the Read class that hides the detail form when the hide button is clicked.
ā€¢ Add a vote_button_click method to the Read class that proves the eligibility of the ballot when the vote button is clicked.
ā€¢ Add an update_status method to the Read class that updates the status of the ballot based on the current time and the ends_at attribute of the ballot. This method should also update the enabled state of the "Cast Vote" button.
ā€¢ Call the update_status method in the __init__ method to ensure the status is updated whenever the ballot page is loaded.
client_code/forms/routes/ballot/Read/form_template.yaml Modify client_code/forms/routes/ballot/Read/form_template.yaml with contents:
ā€¢ Add a new Label component to the components list. This component should be named status_label and should be placed in the 'PTNTKI,JPITRI' grid position.
sweep-ai[bot] commented 1 year ago

GitHub actions yielded the following error.

##[group]Run python -m black --check .
python -m black --check .
shell: /usr/bin/bash -e {0}
env:
pythonLocation: /opt/hostedtoolcache/Python/3.7.17/x64
PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.7.17/x64/lib/pkgconfig
Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.7.17/x64
Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.7.17/x64
Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.7.17/x64
LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.7.17/x64/lib
##[endgroup]
would reformat /home/runner/work/electora-app/electora-app/client_code/forms/routes/ballot/Read/__init__.py

Oh no! šŸ’„ šŸ’” šŸ’„
1 file would be reformatted, 26 files would be left unchanged.
##[error]Process completed with exit code 1.

The command that failed is python -m black --check ..

There are a lot of errors. This is likely due to a small parsing issue or a missing import with the files changed in the PR.

This is likely a linting or type-checking issue with the source code. Update the code changed by the PR. Don't modify the existing tests.

sweep-ai[bot] commented 1 year ago

GitHub actions yielded the following error.

##[group]Run python -m black --check .
python -m black --check .
shell: /usr/bin/bash -e {0}
env:
pythonLocation: /opt/hostedtoolcache/Python/3.7.17/x64
PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.7.17/x64/lib/pkgconfig
Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.7.17/x64
Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.7.17/x64
Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.7.17/x64
LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.7.17/x64/lib
##[endgroup]
would reformat /home/runner/work/electora-app/electora-app/client_code/forms/routes/ballot/Read/__init__.py

Oh no! šŸ’„ šŸ’” šŸ’„
1 file would be reformatted, 26 files would be left unchanged.
##[error]Process completed with exit code 1.

The command that failed is python -m black --check ..

There are a lot of errors. This is likely due to a small parsing issue or a missing import with the files changed in the PR.

This is likely a linting or type-checking issue with the source code. Update the code changed by the PR. Don't modify the existing tests.

sweep-ai[bot] commented 1 year ago

šŸš€ Wrote Changes

##[group]Run python -m black --check .
python -m black --check .
shell: /usr/bin/bash -e {0}
env:
pythonLocation: /opt/hostedtoolcache/Python/3.7.17/x64
PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.7.17/x64/lib/pkgconfig
Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.7.17/x64
Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.7.17/x64
Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.7.17/x64
LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.7.17/x64/lib
##[endgroup]
would reformat /home/runner/work/electora-app/electora-app/client_code/forms/routes/ballot/Read/__init__.py

Oh no! šŸ’„ šŸ’” šŸ’„
1 file would be reformatted, 26 files would be left unchanged.
##[error]Process completed with exit code 1.

The command that failed is python -m black --check ..

There are a lot of errors. This is likely due to a small parsing issue or a missing import with the files changed in the PR.

Hi @sweep-ai[bot],

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:
ā€¢ Format the Python code in the file using the Black code style. This can be done by running the command python -m black client_code/forms/routes/ballot/Read/__init__.py in the root directory of the project.
sweep-ai[bot] commented 1 year ago

šŸš€ Wrote Changes

##[group]Run python -m black --check .
python -m black --check .
shell: /usr/bin/bash -e {0}
env:
pythonLocation: /opt/hostedtoolcache/Python/3.7.17/x64
PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.7.17/x64/lib/pkgconfig
Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.7.17/x64
Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.7.17/x64
Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.7.17/x64
LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.7.17/x64/lib
##[endgroup]
would reformat /home/runner/work/electora-app/electora-app/client_code/forms/routes/ballot/Read/__init__.py

Oh no! šŸ’„ šŸ’” šŸ’„
1 file would be reformatted, 26 files would be left unchanged.
##[error]Process completed with exit code 1.

The command that failed is python -m black --check ..

There are a lot of errors. This is likely due to a small parsing issue or a missing import with the files changed in the PR.

Hi @sweep-ai[bot],

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:
ā€¢ Run the command black client_code/forms/routes/ballot/Read/__init__.py in the root directory of the project to reformat the file according to the Black code style.
ā€¢ After reformatting the file, run the command python -m black --check . to ensure that the file is now correctly formatted.
sweep-ai[bot] commented 1 year ago

GitHub actions yielded the following error.

The command that failed is ruff --format=github .. Here are the relevant lines from the logs:

##[error]client_code/forms/routes/ballot/Read/__init__.py:11:16: F821 Undefined name `datetime`
##[error]client_code/forms/routes/ballot/Read/__init__.py:14:12: F821 Undefined name `ReadTemplate`
##[error]client_code/forms/routes/ballot/Read/__init__.py:17:21: F821 Undefined name `FormattedBallot`
##[error]client_code/forms/routes/ballot/Read/__init__.py:19:53: F821 Undefined name `manager`
##[error]client_code/forms/routes/ballot/Read/__init__.py:28:9: F821 Undefined name `proof`

This is likely a linting or type-checking issue with the source code. Update the code changed by the PR. Don't modify the existing tests.

sweep-ai[bot] commented 1 year ago

GitHub actions yielded the following error.

The command that failed is ruff --format=github .. Here are the relevant lines from the logs:

##[error]client_code/forms/routes/ballot/Read/__init__.py:11:16: F821 Undefined name `datetime`
##[error]client_code/forms/routes/ballot/Read/__init__.py:14:12: F821 Undefined name `ReadTemplate`
##[error]client_code/forms/routes/ballot/Read/__init__.py:17:21: F821 Undefined name `FormattedBallot`
##[error]client_code/forms/routes/ballot/Read/__init__.py:19:53: F821 Undefined name `manager`
##[error]client_code/forms/routes/ballot/Read/__init__.py:28:9: F821 Undefined name `proof`

This is likely a linting or type-checking issue with the source code. Update the code changed by the PR. Don't modify the existing tests.

sweep-ai[bot] commented 1 year ago

āŒ Failed to get files

Please join our Discord to report this issue.

sweep-ai[bot] commented 1 year ago

šŸš€ Wrote Changes

The command that failed is ruff --format=github .. Here are the relevant lines from the logs:

##[error]client_code/forms/routes/ballot/Read/__init__.py:11:16: F821 Undefined name `datetime`
##[error]client_code/forms/routes/ballot/Read/__init__.py:14:12: F821 Undefined name `ReadTemplate`
##[error]client_code/forms/routes/ballot/Read/__init__.py:17:21: F821 Undefined name `FormattedBallot`
##[error]client_code/forms/routes/ballot/Read/__init__.py:19:53: F821 Undefined name `manager`
##[error]client_code/forms/routes/ballot/Read/__init__.py:28:9: F821 Undefined name `proof`

Hi @sweep-ai[bot],

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 the import statement for the datetime module at the top of the file.
ā€¢ Determine the locations of the ReadTemplate, FormattedBallot, manager, and proof classes/modules.
ā€¢ Add the appropriate import statements for the ReadTemplate, FormattedBallot, manager, and proof classes/modules at the top of the file.