Download & Extend

Allow option to display poll answer options in random order

Project:Decisions
Version:6.x-1.3
Component:Code
Category:feature request
Priority:critical
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

Attached is a patch that will allow the order of answers to be randomized when the poll is viewed. There is a checkbox on the node add/edit screen that allows the creator/editor to specify whether the answers are to be randomized for the particular poll.

AttachmentSize
randomize_answers.patch6.32 KB

Comments

#1

Priority:normal» critical
Status:active» needs work

Thank you for your contribution to the project! I think this feature would be a great addition, and barring any major issue in testing, I think it should go in. I have some nitpicking over the patch here, and I need to test it before committing it, but it's otherwise a very welcome addition that I hope will make it in the next release.

Here's the quick code-wise review.

+++ decisions.install 10 Sep 2009 21:28:12 -0000
@@ -113,6 +114,16 @@ function decisions_update_5() {
+function decisions_update_6() {

this should be update_6000, since we're in D6 now

+++ decisions.module 10 Sep 2009 21:28:12 -0000
@@ -1086,7 +1086,6 @@ function decisions_load($node) {
-  $decision->choices = count($decision->choice);

why is that necessary? i remember this assignment was necessary for the form display...

#2

Status:needs work» needs review

I think you looked at the wrong function, because I did have decisions_update_6(). Changed it to decisions_update_6000().

I'm not sure why I had that line removed, so I added it back.

Also noticed I was missing an update for selections.module, and my update and insert queries in decisions.module weren't quite right.

Re-rolled patch is attached.

AttachmentSize
randomize_answers.patch 7.08 KB

#3

Did some more cleanup:

  1. Added more comments to _decisions_randomize_options()
  2. Removed commented out dsm() call from _decisions_randomize_options()
  3. I had the number of options hardcoded to 5, so added $num_choices to call to _decisions_randomize_options() from ranking_decisions_voting_form() and selection_decisions_voting_form()
AttachmentSize
randomize_answers.patch 7.43 KB

#4

Status:needs review» fixed

Committed thanks!

#5

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

nobody click here