How should we implement polls?

[quote=“cpradio, post:20, topic:11911”]
I agree with this as the initial implementation, but would like to see being able to choose multiple options later (a feature that likely doesn’t get a lot of usage; but there are times it is needed).[/quote]
How about something like:

`

  • choose one option
  • or choose another option
  • but can’t choose more than one
    `

and

`

  • choose this option
  • and this option, if you like
  • CHOOOZ ALL THE OPSHUNS!!
    `

for distinguishing between single/multiple choice?

Or would that be too limiting … I guess maybe you need to be able to restrict the number of multiple choices, eg “Choose up to 3”. Would you need to distinguish between “Choose 3” and “Choose up to 3”?

So you could have <poll max=3>, <poll set=3> or just <poll> for an unlimited multiple choice.

1 Like

If this is going to be implemented as a plugin, couldn’t you use that plugin’s render capability anywhere whether it’s the first post or not? That way anywhere a <poll> element is found the plugin can handle it?

Sure, but polls in the middle of topics are very odd beasts.

1 Like

True, but it would have been useful in this post where a choice was a natural part of the discussion. I understand that I could have created a linked post, and started with a poll - but I don’t know if that would have the right flow.

Yes, it was a part of the discussion, but I disagree in that it was natural.

Actually the topic you mentioned would optimally contain a variety of choices, stacked up in due course. After that, a poll could be added if an authorized individual were to decide that that particular stack is big enough to choose one element from the stack. Said poll could be edited into the first post, attached to it or attached to the whole topic.

Your list of choices is perfect because it preserves the flow, whereas a poll would likely make the user stop reading. The way it is right now actually forces people to answer and explain their choice, which adds semantics to following user contributions.
Polls rarely have the purpose of doing that. Instead, they give an overview of the general opinion on a matter or, in some cases, define what is going to happen.

Whenever well-founded contributions are needed, polls are superflous.

I feel it is rather the nature of a topic to only discuss a single topic - as the name suggests. Kind of like how functions should only ever do one thing, topics containing a poll should only ever return results which all refer to the same affair.

I agree with @pyro240 (I think? I had trouble processing that last post entirely) that the correct course of action is

  • edit a poll into the first post (if it comes to that)
  • link to the first post in the latest post as needed

Polls in the middle of topics feels quite wrong to me.

4 Likes

I second @codinghorror here. Though I feel a better process is to create a new topic with a focus on the poll once there is an agreement in the discussion about which things should be voted upon instead of changing the first post (always a bit awkward imho). But yes, polls in the middle of a topic will be hard to find, especially since we jump the user to the last part of the conversation every time, it should be clear where to find a poll if it is in a topic.

Regrading the implementation of this, I was wondering whether there are plans to make this a core feature. As we want this kind of feature for the OpenTechSchool community, I was thinking of creating a plugin for this when the conversation gained momentum again. My problem with writing that plugin in the current framework is that it is unclear to me how to do backend, ruby model and migration additions to discourse. Is the recommended way of doing that building your own gem or shall this work with the ./plugin infrastructure? I’d volunteer for building that plugin if I get some hints here.

Nice to see new forum prophet. When I’m reading your posts it feels like I am reading my mind from large distance. Same way of thinking how the things should be.

Well while the clean design is nice, I’d like to have poll results anonymous. Or at least to have it optional.

Another thing is the optional restrictions by trust level, e.g. limit who can vote on certain polls.

3 Likes

I’ve got this basically working, just need to improve the interface and clean things up a bit.

Imgur

@sam is there any way to do an atomic get-and-set on PluginStore rows, or maybe an interface to use Redis-backed locking?

Also when you say this:

Do you mean the user who created the poll shouldn’t be able to change the options after 5 minutes, or that after voting a user can’t change their vote after 5 minutes?

4 Likes

Wow this looks amazing, if you PR it maybe we can assist on the final details.

Do you mean create a PR to add it to core by default like the emoji plugin? If not I’ve put it up on Github: https://github.com/discourse/discourse-poll

(Need to organize it better, right now everything is in plugin.rb. Also add some sort of visualization.)

Demo: http://forums.hummingbird.me/t/poll-chitoge-vs-onodera/5256

Would you mind if we keep this plugin under the “discourse” section, we can start a project for you there and give you admin. on the repo

Sure, that works for me.

1 Like

OK, you should have access to https://github.com/discourse/discourse-poll

Will review and see if there are any areas that need TLC in the plugin :slight_smile:

I had a chat with @codinghorror and we would like to include the poll plugin in the Discourse source tree, so its installed and enabled by default, just like the emoji one is.

Can you put a pull request through and I will work through getting this shipshape :slight_smile:

4 Likes

be aware that color blind people (and people with some level of color blindness) will use the software too, so it must be accessible, not just fancy

2 Likes

Indeed, I am colorblind, and I use/see this type of visualization quite often. I rarely encounter any issue with color schemes as long as they were correctly selected. I believe that’d be the case for discourse as we have time, before pushing into production the feature, to pick a color scheme.

2 Likes

I checked the readme, and this thread, but didn’t see how to create a poll.

Could someone point us in the right direction & maybe post it here:

https://github.com/discourse/discourse-poll/blob/master/README.md Thanks!

Make your topic title start with "Poll: " and include a list in your post. The first list will be used. If you don’t want it to be the first list, do this:

Intro Text

 - Some list
 - Some list con't

Here are your choices:

[poll]
 - Option 1
 - Option 2
[/poll]

Currently, the options bug out if you do any markdown other than a list, escaping the <b> and <a> tags and such, so try to avoid formatting in the choices for now until that’s fixed.

6 Likes