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

fix: do not allow to answer a poll after voting period ends #964

Merged
merged 9 commits into from
Jul 14, 2022

Conversation

RiccardoM
Copy link
Contributor

@RiccardoM RiccardoM commented Jul 7, 2022

Description

This PR fixes a bug within the x/posts module that currently allows users to answer a poll even when it's already ended.


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

Signed-off-by: Riccardo Montagnin <riccardo.montagnin@gmail.com>
@codecov
Copy link

codecov bot commented Jul 7, 2022

Codecov Report

Merging #964 (8188751) into master (8e42c6a) will decrease coverage by 0.02%.
The diff coverage is 73.33%.

❗ Current head 8188751 differs from pull request most recent head b98570c. Consider uploading reports for the commit b98570c to get more accurate results

@@            Coverage Diff             @@
##           master     #964      +/-   ##
==========================================
- Coverage   82.46%   82.43%   -0.03%     
==========================================
  Files         167      168       +1     
  Lines       14244    14289      +45     
==========================================
+ Hits        11746    11779      +33     
- Misses       2014     2023       +9     
- Partials      484      487       +3     
Impacted Files Coverage Δ
x/posts/module.go 8.86% <0.00%> (-0.35%) ⬇️
x/posts/legacy/v4/store.go 76.92% <76.92%> (ø)
x/posts/keeper/msg_server.go 89.85% <100.00%> (+0.08%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 128cbdc...b98570c. Read the comment docs.

Signed-off-by: Riccardo Montagnin <riccardo.montagnin@gmail.com>
Signed-off-by: Riccardo Montagnin <riccardo.montagnin@gmail.com>
Signed-off-by: Riccardo Montagnin <riccardo.montagnin@gmail.com>
Signed-off-by: Riccardo Montagnin <riccardo.montagnin@gmail.com>
@RiccardoM RiccardoM added the automerge Automatically merge PR once all prerequisites pass label Jul 8, 2022
@RiccardoM RiccardoM marked this pull request as ready for review July 8, 2022 05:42
Copy link
Contributor

@leobragaz leobragaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍


// removeUserAnswers iterates over all the polls and deletes the user answers for all the polls which
// final results already been tallied. This is to delete all the answers that have been added after that.
func removeUserAnswers(store sdk.KVStore, cdc codec.BinaryCodec) error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would name it removeInvalidAnswers.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

Signed-off-by: Riccardo Montagnin <riccardo.montagnin@gmail.com>
x/posts/legacy/v4/store.go Outdated Show resolved Hide resolved
Co-authored-by: Paul <p22626262@gmail.com>
Copy link
Contributor

@dadamu dadamu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great to me

@mergify mergify bot merged commit bc97e72 into master Jul 14, 2022
@mergify mergify bot deleted the riccardom/improve-polls-answers branch July 14, 2022 05:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Automatically merge PR once all prerequisites pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants