FriendsOfFlarum / polls

A Flarum extension that adds polls to your discussions
https://discuss.flarum.org/d/20586
MIT License
23 stars 12 forks source link

Add an option for polls to allow users to vote for multiple items #69

Closed dsevillamartin closed 1 year ago

dsevillamartin commented 1 year ago

Fixes #3

Changes proposed in this pull request:

Reviewers should focus on:

Screenshot image image

Confirmed

dsevillamartin commented 1 year ago

New changes make the poll look like this. I know a 'max votes' option could probably be standalone without a switch for multiple votes, but that switch might be better UX? Unsure. I don't think it's a big concern regardless.

image image

dsevillamartin commented 1 year ago

I've improved the performance of the new endpoint. These metrics are with the poll screenshoted above - two options. The # of selects goes up like 1 per additional option after this improvement, before it went up by 2 per option.

# OF QUERIES Voting Unvoting Changing Vote
Before PR (legacy endpoint) 21 19 24
Before optimization 21 (~14 ms) 19 (~12 ms) 24 (~15 ms )
After optimization 19 (~8 ms) 17 (~6 ms) 21 (~9 ms)

This performance seems to be better than the legacy endpoint.