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: voting with same answers #5674

Merged
merged 10 commits into from Jan 27, 2023
Merged

Conversation

maxwellmattryan
Copy link
Contributor

@maxwellmattryan maxwellmattryan commented Jan 26, 2023

Summary

Please summarize your changes, describing what they are and why they were made.

This PR fixes users being able to submit votes with the same answers. It also allows a user to vote, switching just a single answer if he or she wishes.

Changelog

- Add logic to check if selected answer is same as voted answer
- Add logic to improve UX of answer selection
- Add function to get active participation if any

Relevant Issues

Fixes #5634

Testing

Platforms

Please select any platforms where your changes have been tested.

  • Desktop
    • MacOS
    • Linux
    • Windows
  • Mobile
    • iOS
    • Android

Instructions

Please describe the specific instructions, configurations, and/or test cases necessary to test and verify that your changes work as intended.

Test with long and short ballots, including ones that are being actively voted for and new ones.

Checklist

Please tick all of the following boxes that are relevant to your changes.

  • I have followed the contribution guidelines for this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or modified tests that prove my changes work as intended
  • I have verified that new and existing unit tests pass locally with my changes
  • I have verified that my latest changes pass CI workflows for testing and linting
  • I have made corresponding changes to the documentation

@maxwellmattryan maxwellmattryan marked this pull request as ready for review January 26, 2023 03:05
Copy link
Contributor

@MarkNerdi996 MarkNerdi996 left a comment

Choose a reason for hiding this comment

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

Not sure if i fully understand everything you're doing here but i have another way in mind how we could solve this.

Instead of setting things to undefined if we select the already voted one, and then handle this in the handleVoteClick, we could just update the check in isVotingDisabled with a function areAllSelectedAnswersAlreadyActive where we compare the 2 arrays

Copy link
Contributor

@MarkNerdi996 MarkNerdi996 left a comment

Choose a reason for hiding this comment

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

LGTM, good job!

@MarkNerdi996 MarkNerdi996 merged commit 6ff3705 into develop Jan 27, 2023
@MarkNerdi996 MarkNerdi996 deleted the fix/voting-with-same-answer branch January 27, 2023 07:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug report]: Submitting the same vote multiple times is not deactivated
2 participants