How to change a poll while it is live (without losing the data)

I’ve found that when my users start with polls, they make all kinds of errors which often aren’t realised until the poll is well underway.

Unfortunately, any edits to a poll cause the poll data to be wiped. This is understandable for poll integrity, but is sometimes highly undesirable when a simple tweak can fix a big problem for the user.

It is, however, doable via the rails console. Hacking a live poll changes the behaviour of the poll whilst preserving the data, but the markdown is not touched. I’m not sure what happens when you rebake the post, but suspect that the poll will revert to its original behaviour. By then it is likely to be old and forgotten so this isn’t a big deal.

The key is finding the post id; an easy way to find it is this SQL query (the poll of interest should be near the top):

SELECT post_id as postid, *
FROM polls
ORDER BY id desc

Here is an example poll hack, for when the user accidentally made a poll single rather than multiple:

Poll.find_by_post_id(75571).update(type:1,min:1,max:4)

You should be able to piece together other hacks from the query and that starting point.

4 Likes

I’ve moved this one over to installation rather than have it as an endorsed guide as it falls under the ‘sidestepping UI in rails’ scope (similar to the email in one previously).

I think we could do with some kind of halfway house for these kinds of tips as they are useful, but have an element of ‘at your own risk’ to them. Let me check back in and see what current opinions are. :+1:

1 Like

Perhaps one tag more would be helpful, like #unofficial-tip or #dig-your-own-grave. Then categories could be more… on topic, but there would be an indicator telling that there is demand of some knowledge and a risk to fail miserably.

3 Likes

That’s a nice tip.

I usually run a Topic to create a draft poll outline and invite senior members to suggest improvements or missing options.

Then I run the poll.

4 Likes

Yeah, so do I, especially for highly important polls.

But I also want to encourage my users to do it themselves independently, and this means supporting them as they learn and inevitably make mistakes.

1 Like

Why can’t we just fix this in the UI? Poll integrity, blah blah blah. It’s usually just a typo, and leaving it there kills me, but it is better than wiping the votes. … I shouldn’t have to make that choice.

And why not change it later if an admin wants to? Sometimes the polls are just fun, and preserving the “integrity” is definitely not the top priority. The fact that the whole thing blows up even if you allow later editing makes that setting useless. We should be able to have a setting where we allow editing without losing votes… if that is how we want to run our site.

3 Likes