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

sort-by-votes #20

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

RahulNavneeth
Copy link

Sorting the options by vote quantity

Changes that are made:

  1. In IPoll interface.

    Instead of separate options and vote datatype - combined both as data.

    Before:
    options: Array<string>
    votes: Array<IVoter>

    Screenshot 2023-02-28 at 12 42 13 AM

    After:
    data: Array<{option: string, votes: Array<IVoter>}>

    Screenshot 2023-02-28 at 12 42 35 AM

    Advantage: Can be accessed easily.

  2. Sorted the options with the highest votes at the top.

    Before:

    BEFORE.mp4

    After:

    AFTER.mp4

Fixes #19

@RahulNavneeth
Copy link
Author

Hi @murtaza98 , Can you kindly review this Pull request. Thanks 😄.

@murtaza98
Copy link

Hi @RahulNavneeth Firstly, thanks for the contribution. I liked your idea of sorting by votes. Any chance you could isolate that feature in a separate PR?

Wrt the changing of data types of votes, I'm not sure I understood the reason y you had to do this. Can you please elaborate on this further? What was the limitation of the previous type and how this new type solves those issues

@RahulNavneeth
Copy link
Author

RahulNavneeth commented Mar 9, 2023

Sure sir, To improve the process of vote manipulation and avoid bottlenecks - instead of only manipulating the votes, merging the votes and options as a single entity can be a viable solution. This way, each vote will have its own options and votes method, which can result in a more efficient and streamlined process.

Screen.Recording.2023-03-09.at.7.22.17.PM.mov

As seen in the example provided, this approach allows manipulation and sorting only for the votes without modifying the options, thus arriving at potential bottlenecks.

BEFORE:

Screenshot 2023-03-09 at 7 34 00 PM

Sorts only the votes

WORKAROUND

Screenshot 2023-03-09 at 8 39 43 PM

Lot of boilerplate

AFTER:

Screenshot 2023-03-09 at 7 34 59 PM

The vote sorting process is done comprehensively with both the votes and options altogether

@RahulNavneeth
Copy link
Author

RahulNavneeth commented Mar 9, 2023

Sir, as requested I have isolated the sorting feature in a separate PR #23 .

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

Successfully merging this pull request may close these issues.

[IMPROVE] : Sorting the options by vote quantity
2 participants