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

Add voters count support #11917

Merged
merged 5 commits into from
Sep 29, 2019
Merged

Conversation

ClearlyClaire
Copy link
Contributor

@ClearlyClaire ClearlyClaire commented Sep 22, 2019

For newly-created polls, count voters in addition to the number of votes.
Present them in the REST API as voters_count and over ActivityPub as toot:votersCount.

When that information is available, the text now says “X voters” instead of “X votes”, and the tallies use that for percentages instead of the total number of votes (which is far less useful for anyOf polls)

Marked as a draft because it probably could use more tests, and I'm very unsure about the attribute it should use.

image

@ClearlyClaire ClearlyClaire force-pushed the features/voters-count branch 5 times, most recently from e8c9fc6 to ec6f4a3 Compare September 22, 2019 12:42
@ClearlyClaire ClearlyClaire force-pushed the features/voters-count branch 2 times, most recently from ba8feb8 to 8f07eb1 Compare September 22, 2019 13:53
@Gargron
Copy link
Member

Gargron commented Sep 22, 2019

I'm hesitant to add another custom property. Is the problem being solved the confusion around submitting another multiple-choice vote -> number of votes going up? That doesn't seem wrong to me per se.

@ClearlyClaire
Copy link
Contributor Author

It's not just that. 40 people voting just one option each is indistinguishable from 10 people all voting all the options, although those have very different meanings ultimately

@trwnh
Copy link
Member

trwnh commented Sep 22, 2019

instead of votersCount i would propose something like using totalItems of the replies Collection. whether the Question is oneOf or anyOf should be irrelevant; each reply should contain an array of the selected answers.

@ClearlyClaire
Copy link
Contributor Author

@trwnh no, that would mean listing all the votes, and each vote is for one option only, so that would just be equivalent to what we currently do

@trwnh
Copy link
Member

trwnh commented Sep 22, 2019

Wait, so one vote creates multiple responses? That doesn't make sense...

@ClearlyClaire
Copy link
Contributor Author

ClearlyClaire commented Sep 22, 2019 via email

@ClearlyClaire ClearlyClaire marked this pull request as ready for review September 26, 2019 08:32
@ClearlyClaire
Copy link
Contributor Author

Marked as ready for review as there seem to be an agreement that the AS vocabulary isn't enough for this and pleroma devs are ok with the chosen attribute name.

@ClearlyClaire ClearlyClaire force-pushed the features/voters-count branch 3 times, most recently from 9ec9777 to 5de347c Compare September 29, 2019 19:27
@Gargron Gargron merged commit 3babf84 into mastodon:master Sep 29, 2019
hiyuki2578 pushed a commit to ProjectMyosotis/mastodon that referenced this pull request Oct 2, 2019
* Add voters count to polls

* Add ActivityPub serialization and parsing of voters count

* Add support for voters count in WebUI

* Move incrementation of voters count out of redis lock

* Reword “voters” to “people”
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.

None yet

4 participants