i don't know if poll.module is really considered "core" in the same sense as the truly core parts of drupal. it's a nice module and all, but it's optional, not central to the proper functioning of all drupal sites. i'm hoping that since it's a more peripheral module, that the core developers might be a little more flexible about getting a new feature committed before 4.7 is frozen.

the attached patch provides the following new functionality for poll.module:

  • once a user has voted for a given poll, when they view results (the node view tab), they see their own vote, in addition to the summary bar graph and totals.
  • users can now cancel their own vote (so they can change their mind)
  • anyone with 'view poll votes' permission now sees a new "votes" tab when viewing the node, which contains a table of all the replies to a given poll (2 columns: name or IP addr, and the text of their vote).

this is my first patch against cvs/4.7, so please let me know if i screwed anything up. i tested it on a 4.7 site, and it all works, but the experienced eyes of a reviewer might catch some weird corner cases i missed. also, i'm not sure i did the pgsql related changes correctly, since my site's only running mysql and i have no experience w/ postgres.

i should probably change the code for the "votes" tab to use a tablesort_pager(), right? that'll be a small change which i can either do as a separate patch or i can make a new version of this monolithic patch that includes it. let me know if that'd be necessary or worthwhile.

also, i didn't change the fact that site admins can arbitrarily edit the totals for each choice in the edit tab. i wasn't sure if that was a feature someone added on purpose, or if it was a necessary evil. now that the poll_votes table is storing the actual vote along with the nid and the uid or hostname, we could easily recompute the real totals whenever we wanted, instead of maintaining the totals in the poll_choices table. can someone comment on that, too? i thought about adding a check-box on the edit tab's form to "recompute totals", so that admins can still alter the totals if they need to, but to provide an easy way to reset them to the real values whenever they want.

thanks!
-derek

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dww’s picture

Assigned: Unassigned » dww
Status: Needs review » Needs work

the patch no longer applies cleanly to HEAD, and there are a few minor problems in the code (i've learned a lot about drupal since i posted this patch). ;) i'll roll a new one in a few days that will actually be ready for review.

thanks,
-derek

matt_paz’s picture

This shoulds great! I'm looking forward to the updated patch. Let me know if you need any help testing.

dww’s picture

Status: Needs work » Needs review
FileSize
10.35 KB

as promised, the updated patch. since i'm so optimistic that my patch for http://drupal.org/node/18018 will be committed soon, i wrote the update for this as system_update_184(), since the last current update is 182, and my patch from #18018 is using 183. ;)

otherwise, i think this is basically good to go. as i wrote in my original post, there are some unresolved questions about the administrative UI (namely, the ability to change the # of votes arbitrarily, instead of just using a reliable count of what's already been recorded in the DB). also, i don't provide any sort of update for converting existing poll votes in the DB into the new method (since there's no way to know what votes are what). not sure if there's anything i can/should do about that.

anyway, please review and test...

thanks!
-derek

dww’s picture

and lo, a new patch with a pager_query() on the "votes" tab...

Dries’s picture

What does 'chorder' mean? I'm not too fond of this variable name. It's not really descriptive, at least not to me.

Also, there is some missing spaces in the patch.

Otherwise looks OK.

dww’s picture

Status: Needs review » Needs work

"choice order", i think. i didn't like it, either, but was just using the existing name (i.e. from the {poll_choices} table), and the variables in the existing code. i thought consistency with the rest of the module was more important than a better name. i could make a much bigger patch that renames "chorder" in the DB and the entire module, but that seems like a lot more work (and probably the job of a separate issue). let me know what you think. i think i see the missing spaces you're talking about. i'll roll a new patch momentarily. thanks.

dww’s picture

Status: Needs work » Needs review
FileSize
10.35 KB

actually, i only found 1 missing space. ;) but i did find a } else {, and 1 extra newline. new patch to fix these 3 minor formatting problems.

so, what's it going to be about chorder? consistency with what's there now (+1) or major cleanup (+1 in principle, but i'd prefer a separate issue and another time, so -1 in terms of this patch)? ;)

thanks,
-derek

Dries’s picture

Mmm, I don't understand how 'choice order' would be relavant for your code? What exactly are you storing in 'chorder'?

dww’s picture

your actual vote on each poll. {poll_votes} currently stores nid (which poll) and an identifier (uid or hostname), to make sure you don't vote twice on the same poll. i'm just adding the chorder field (from {poll_choices}) so we also know what you voted on that particular poll. chorder is just the per-poll offset of what you selected (0 = the first choice in the list, etc). so, given the nid and the chorder, we know exactly what you selected. given the uid or hostname, we know who you are. make sense?

beginner’s picture

Status: Needs review » Needs work

-1 on the module as it is now, but the fix should be very easy.
By default, you can only vote for one choice (that's called Plurality Voting). What's worse, it's the only choice.
The default should be Approval voting (being able to vote for several choices at the same time).

For an illustration, see:
http://groups.drupal.org/node/271

For more comments on voting systems, and why Plurality voting is such a bad idea, see:
http://groups.drupal.org/node/237

Dries’s picture

Status: Needs work » Needs review

Why don't we call it 'vote' then? It is dozen times easier to understand than 'chorder' ...

beginner’s picture

What about privacy issues?
Maybe add a warning that the users' vote are stored and that site admins can view what they voted.

But at least, do change the default voting methods. (see my comments about why it is that ALL cms use such a poor voting method by default).

beginner’s picture

Status: Needs review » Needs work

I just reviewed the patch.

dww’s picture

Status: Needs work » Needs review

dries: i agree: "vote" makes much more sense. as i said in #6, the only reason i used "chorder" was to match what the rest of the code (and existing db tables) called this offset. if you prefer to rename "chorder" to "vote" in all instances, i agree, but i'd rather do that as a totally separate issue/patch. are you ok with that?

beginner: yes, this style of voting leaves a lot to be desired. there's a whole group around better voting. all that's well and good and all. ;) however, i'm not going to get into the debate about such massive new functionality in the poll module while it's still in core. there's talk about moving it out of core so it can be more actively developed for exactly these sorts of features (there was a long thread on the development list about a month ago, check the archives if you're interested). however, until that happens, please don't muddy the waters of this relatively simple enhancement to the existing poll functionality. ;) thanks.

dww’s picture

What about privacy issues?
Maybe add a warning that the users' vote are stored and that site admins can view what they voted.

perhaps. however, i don't think anyone has any reasonable expectation of privacy in on-line polls, do you? ;) i mean, i certainly don't expect anytime i vote on-line that it's really a secret ballot by any means. sites that really care about this are free to add such a warning in the theme layer, too...

beginner’s picture

If you read what I was talking about, you would know that it's not a massive "new functionality": just change radios to checkboxes and you're done!
This is the default the more appropriate for most polls created by unknowing site-admins and users. And you'd be educating people and doing a service to the world (!!).

All of that only by replacing radios by checkboxes!

beginner’s picture

I meant to highlight: it is NOT a massive new functionality in terms of code, but it certainly is in terms of service to the society.

Do you want me to re-roll a patch?

It'd be a shame to miss this opportunity. :(

Dries’s picture

beginner: let me commit this patch, and then we can start a new issue about the other functionality. I'm all for extending the poll.module, as long it is clean and elegant. :)

dww’s picture

beginner: yes, this is a big change. not only changing the input, but a) how it's stored in the DB, b) how it's displayed, c) how it's documented, etc. please, just file a new issue with your own patch and your own motivation. do not hijack this one. ;) thanks,
-derek

p.s. i agree plurality voting would be better. i'm fully in support of the "better voting methods stuff", i belong to that group on groups.drupal.org, etc, etc. i'd be willing to help maintain poll once it's out of core to add all sorts of better voting options. however, until poll is out of core, i don't want to get into this debate. you're not really helping anything in this issue by trying to force this discussion. thanks for your concern and desire to improve this, but this isn't the place. thanks.

beginner’s picture

Status: Needs review » Reviewed & tested by the community

:(

Dries’s picture

Status: Reviewed & tested by the community » Needs work

Does everyone agree that people should be able to cancel their vote? (It not a common feature and there is no way to disable it.)

Also, when a vote is canceled, we might want to flush the cache so that the change becomes visible to anonymous users?

dww’s picture

i suppose i could add a checkbox in the poll node for if it should allow votes to be canceled. that'd just require a few changes to the code, and a new field in the {poll} table. i didn't think that was necessary, but if you'd prefer, i'd be glad to add it.

in terms of flushing the cache, i didn't even think of it. again, if you think it's worth doing, i'll add it. i don't usually think of anonymous users and the cache much, i should get in the habit of that. ;)

dww’s picture

Status: Needs work » Needs review
FileSize
13.55 KB

oh crap. :( poll_update() is currently doing this:

db_query('DELETE FROM {poll_votes} WHERE nid = %d', $node->nid);

so, whenever you edit an existing poll, this destroys all the historical record of votes on that poll. that seems like a bug in its own right (folks can vote multiple times if the admin edits a poll node). this really screws things up for my patch, too, since you can get in a situation where the "results" tab shows you N votes for a given choice, but the "votes" tab is empty. :( part of me wants to just rip that line out completely. however, under the assumption that the admin might have changed what all the vote choices are (e.g. swapping 'yes' and 'no'), then all of a sudden, everyone's votes might be wrong. seems like editing existing polls isn't particularly well thought out. not sure what to do here.

however, all of that is basically orthogonal to my patch. my patch makes these failings more obvious, but doesn't actually make them any worse (or introduce new problems that didn't already exist). so, here's the patch that adds the checkbox to allow/disallow canceling votes to the poll edit page. i opted for the more verbose and more clear fieldname of "votes_can_change" in the poll table. if you've got a better suggestion, let me know.

thanks,
-derek

Dries’s picture

That is bad. Fixing a typo in one of the available choices will wipe all votes? Without a warning, even.

The solution is probably to introduce an extra button 'Clear votes' that sits next to 'Submit' and 'Delete' button. Then, when you click that button, it will ask you for confirmation.

Point is that 'updating a poll' and 'wiping its votes' are two distinct actions.

Dries’s picture

As for the votes_can_change setting. Normally this would be implemented as a permission -- or at least, that is what I had in mind, and what I think best matches Drupal's design. This means you can't set the setting on a per poll basis, of course.

dww’s picture

agreed. as i said, this has always been true, my patch just makes it more visible. i doubt anyone really knew this was going on. ;)

so, should this be a separate patch, too? i'd rather clean up all this edit stuff separately, just to keep things more managable. is that cool? if you're ok with that, i'll file a new issue to clearly state what's wrong now and a proposal for how it should be. sound good?

dww’s picture

re: votes_can_change -- sorry, i thought that's what you had in mind. however, now that it's in there, i kind of like having it per-poll instead of per user role. ;) seems sort of unfair to have a vote where only certain people can change their minds, and others are stuck with whatever they happened to hit "submit" on. yet, i can see that on some votes, you might want to disallow re-voting and changing, whereas on others, you would want to allow a longer discussion period where people might change their minds, etc.

i suppose adding a new permission on top of this would give the most flexibility (and require only about 3 more lines of code). would you be in favor of that?

Dries’s picture

I'd go with the permission for now, and leave the per-poll setting out. Should only be 3 lines on top of the previous patch.

dww’s picture

new (final?) patch that has the following modifications to the patch from #7:

1) adds a new permission ('cancel own vote') and enforces it when deciding to present the "Cancel vote" button.

2) fix a minor bug where the "Your vote: " header would be displayed even if you didn't vote.

tested pretty heavily locally (different users in different roles, etc). things are (of course) still busted if you edit the poll, but i'm going to just file a separate issue about that.

Dries’s picture

Status: Needs review » Fixed

I committed a modified version of your patch. Removed some things that looked ugly (needs more UI work), cleaned up some code and fixed a couple bugs. Marking this fixed. Feel free to feed me improvements though.

dww’s picture

Status: Fixed » Needs review
FileSize
1.3 KB

thanks for catching those bugs and other cleanup. my only disappointment is you took out the part where each user sees their own vote. as you can see from the title of this issue, that was one of the important features i was trying to add. ;) i think seeing your own vote directly is helpful, even for users who don't have the new "inspect all votes" permission. is there something i should do to make the UI better so you'd consider re-applying those few lines?

as it is, there's a stray </div> being generated now, so at the very least, you should apply the patch i'm attaching here. i'll attach a trival patch in another follow-up to put the viewing-your-own-vote thing back in (which will also fix this stray </div> problem, so you'll only need to apply one or the other).

thanks,
-derek

dww’s picture

here's the patch that puts viewing your own vote back in. i put this stuff in its own div class, but i didn't modify any default CSS to take advantage of it. maybe that's what you mean by "looks ugly". ;)

Dries’s picture

I committed your first patch. It would be nice if we could make the 'Your vote' stuff look better. I'm going to hold back committing your second patch, hoping some other people will chime in and offer UI suggestions.

dww’s picture

Status: Needs review » Closed (duplicate)

this issue is getting too confusing. ;) there's no patch here that needs review, but a few unrelated threads that need to be resolved. so, i just created separate issues for the remaining tasks:

http://drupal.org/node/67895 ("editing a poll clears all old votes")
http://drupal.org/node/67931 ("UI fix: display current user's vote")

also, i noticed that one of the main bits of the new functionality i added is what folks were talking about back in 2004 in: http://drupal.org/node/12560 ("Allow users to modify their vote on polls").

so, between those 3 issues, this one is now finished. i'm marking it "duplicate" in honor of #12560, which, as the older issue, should get credit for being fixed. ;)

please move any remaining discussion/patches/effort on the edit or UI fixes into #67895 or #67931 as appropriate.

thanks,
-derek

dww’s picture

i told you this issue was too confusing to be useful. ;) i forgot about this part, too:

http://drupal.org/node/67959 (rename "chorder" to something more descriptive like "vote")

BioALIEN’s picture

Version: x.y.z » 4.7.x-dev

@ddw: are you going to spice up this module for the Drupal5 release? It's still lacking some essential options such as redirecting the user after placing a vote. The poll block could also use some HTML make over, which I am willing to help with.

dww’s picture

(FYI: once an issue is marked as "duplicate", it's usually dead to the world. i just happened to notice your update since i keep a close eye on my own stuff).

a) no way in hell D5 poll.module is getting anything other than bug fixes this late in the release cycle.
b) i have no time to make poll.module better anytime soon.
c) poll.module in general is on the way out. there should be a series of poll-style CCK fields in contrib in the D5 life-cycle, hopefully moving into core in D6. find eaton. he's your man. ;)

cheers,
-derek

BioALIEN’s picture

Thanks for the update, totally understand ;)

Maybe we should close this issue to ensure it stays dead?

pasanewa’s picture

how do i use the PATCH ??
the patch is like this...

Index: modules/poll.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/poll.module,v
retrieving revision 1.196
diff -u -F^f -r1.196 poll.module
--- modules/poll.module 7 May 2006 00:08:36 -0000 1.196
+++ modules/poll.module 26 May 2006 03:05:09 -0000
@@ -201,11 +201,24 @@ function poll_menu($may_cache) {
'callback' => 'poll_vote',
'access' => user_access('vote on polls'),
'type' => MENU_CALLBACK);
+
+ $items[] = array('path' => 'poll/cancel',
+ 'title' => t('cancel'),
+ 'callback' => 'poll_cancel',
+ 'access' => user_access('vote on polls'),
+ 'type' => MENU_CALLBACK);
}
else {
if (arg(0) == 'node' && is_numeric(arg(1))) {
$node = node_load(arg(1));
-
+ if ($node->type == 'poll') {
+ $items[] = array('path' => 'node/'. arg(1) .'/votes',
+ 'title' => t('votes'),
+ 'callback' => 'poll_votes',
+ 'access' => user_access('view poll votes'),
+ 'weight' => 3,
+ 'type' => MENU_LOCAL_TASK);
+ }
if ($node->type == 'poll' && $node->allowvotes) {
$items[] = array('path' => 'node/'. arg(1) .'/results',
'title' => t('results'),
@@ -237,10 +250,17 @@ function poll_load($node) {
// Determine whether or not this user is allowed to vote
$poll->allowvotes = FALSE;
if (user_access('vote on polls') && $poll->active) {
- if ($user->uid && db_num_rows(db_query('SELECT uid FROM {poll_votes} WHERE nid = %d AND uid = %d', $node->nid, $user->uid)) == 0) {
- $poll->allowvotes = TRUE;
+ if ($user->uid) {
+ $result = db_fetch_object(db_query('SELECT chorder FROM {poll_votes} WHERE nid = %d AND uid = %d', $node->nid, $user->uid));
}
- else if ($user->uid == 0 && db_num_rows(db_query("SELECT hostname FROM {poll_votes} WHERE nid = %d AND hostname = '%s'", $node->nid, $_SERVER['REMOTE_ADDR'])) == 0) {
+ else {
+ $result = db_fetch_object(db_query("SELECT chorder FROM {poll_votes} WHERE nid = %d AND hostname = '%s'", $node->nid, $_SERVER['REMOTE_ADDR']));
+ }
+ if (isset($result->chorder)) {
+ $poll->vote = $result->chorder;
+ }
+ else {
+ $poll->vote = -1;
$poll->allowvotes = TRUE;
}
}
@@ -272,7 +292,7 @@ function poll_page() {
* Implementation of hook_perm().
*/
function poll_perm() {
- return array('create polls', 'vote on polls');
+ return array('create polls', 'vote on polls', 'view poll votes');
}

/**
@@ -342,12 +362,12 @@ function poll_view_results(&$node, $teas
}
}

- $output .= theme('poll_results', check_plain($node->title), $poll_results, $total_votes, $node->links, $block);
+ $output .= theme('poll_results', check_plain($node->title), $poll_results, $total_votes, $node->links, $block, $node->nid, $node->vote, check_plain($node->choice[$node->vote]['chtext']));

return $output;
}

-function theme_poll_results($title, $results, $votes, $links, $block) {
+function theme_poll_results($title, $results, $votes, $links, $block, $nid, $vote, $vote_str) {
if ($block) {
$output .= '

';
$output .= '
'. $title .'

';
@@ -360,12 +380,21 @@ function theme_poll_results($title, $res
$output .= '

';
$output .= $results;
$output .= '
'. t('Total votes: %votes', array('%votes' => $votes)) .'

';
+ if (isset($vote)) {
+ $form['#action'] = url("poll/cancel/$nid");
+ $form['choice'] = array('#type' => 'hidden', '#value' => $vote);
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Cancel vote'));
+ $output .= '

'. t('Your vote') .": $vote_str ";
+ $output .= drupal_get_form('poll_cancel_form', $form);
+ $output .= '

';
+ }
$output .= '

';
}

return $output;
}

+
function theme_poll_bar($title, $percentage, $votes, $block) {
if ($block) {
$output = '

'. $title .'

';
@@ -395,6 +424,35 @@ function poll_results() {
}

/**
+ * Callback for the 'votes' tab for polls you can see other votes on
+ */
+function poll_votes() {
+ if ($node = node_load(arg(1))) {
+ drupal_set_title(check_plain($node->title));
+ $output = t("This table lists all the recorded votes for this poll. If anonymous users are allowed to vote, they will be identified by the IP address of the computer they used when they voted (which is the method used to prevent anonymous users from voting multiple times). For a summary of the results, use the %view tab", array('%view' => l(t('view'), "node/$node->nid")));
+
+ $result = db_query("SELECT pv.chorder, pv.uid, pv.hostname, u.name FROM {poll_votes} pv LEFT JOIN {users} u ON pv.uid = u.uid WHERE pv.nid = %d ORDER BY pv.chorder, u.name", $node->nid );
+ $header = array(t('Identifier'), t('Vote'));
+ $rows = array();
+ while ($vote = db_fetch_object($result)) {
+ $row = array();
+ if ($vote->name) {
+ $row[] = l(check_plain($vote->name),"user/$vote->uid");
+ } else {
+ $row[] = $vote->hostname;
+ }
+ $row[] = check_plain($node->choice[$vote->chorder]['chtext']);
+ $rows[] = $row;
+ }
+ $output .= theme('table', $header, $rows);
+ print theme('page', $output);
+ }
+ else {
+ drupal_not_found();
+ }
+}
+
+/**
* Callback for processing a vote
*/
function poll_vote(&$node) {
@@ -408,12 +466,12 @@ function poll_vote(&$node) {

if (isset($choice) && isset($node->choice[$choice])) {
if ($node->allowvotes) {
- // Mark the user or host as having voted.
+ // Record the vote by this user or host.
if ($user->uid) {
- db_query('INSERT INTO {poll_votes} (nid, uid) VALUES (%d, %d)', $node->nid, $user->uid);
+ db_query('INSERT INTO {poll_votes} (nid, chorder, uid) VALUES (%d, %d, %d)', $node->nid, $choice, $user->uid);
}
else {
- db_query("INSERT INTO {poll_votes} (nid, hostname) VALUES (%d, '%s')", $node->nid, $_SERVER['REMOTE_ADDR']);
+ db_query("INSERT INTO {poll_votes} (nid, chorder, hostname) VALUES (%d, %d, '%s')", $node->nid, $choice, $_SERVER['REMOTE_ADDR']);
}

// Add one to the votes.
@@ -424,13 +482,48 @@ function poll_vote(&$node) {
drupal_set_message(t('Your vote was recorded.'));
}
else {
- drupal_set_message(t("You're not allowed to vote on this poll."), 'error');
+ drupal_set_message(t("You are not allowed to vote on this poll."), 'error');
}
}
else {
- drupal_set_message(t("You didn't specify a valid poll choice."), 'error');
+ drupal_set_message(t("You did not specify a valid poll choice."), 'error');
}
+ drupal_goto('node/'. $nid);
+ }
+ else {
+ drupal_not_found();
+ }
+}
+
+
+/**
+ * Callback for canceling a vote
+ */
+function poll_cancel(&$node) {
+ global $user;
+
+ $nid = arg(2);
+ if ($node = node_load(array('nid' => $nid))) {
+ $edit = $_POST['edit'];
+ $choice = $edit['choice'];
+ $cancel = $_POST['cancel'];

+ if (isset($choice) && isset($node->choice[$choice])) {
+ if ($user->uid) {
+ db_query('DELETE FROM {poll_votes} WHERE nid = %d and uid = %d', $node->nid, $user->uid);
+ } else {
+ db_query("DELETE FROM {poll_votes} WHERE nid = %d and hostname = '%s'", $node->nid, $_SERVER['REMOTE_ADDR']);
+ }
+
+ // Subtract from the votes.
+ db_query("UPDATE {poll_choices} SET chvotes = chvotes - 1 WHERE nid = %d AND chorder = %d", $node->nid, $choice);
+ $node->allowvotes = true;
+ $node->choice[$choice]['chvotes']--;
+ drupal_set_message(t('Your vote was canceled.'));
+ }
+ else {
+ drupal_set_message(t("You are not allowed to cancel an invalid poll choice."), 'error');
+ }
drupal_goto('node/'. $nid);
}
else {
cvs diff: Diffing database
Index: database/database.4.0.mysql
===================================================================
RCS file: /cvs/drupal/drupal/database/database.4.0.mysql,v
retrieving revision 1.3
diff -u -F^f -r1.3 database.4.0.mysql
--- database/database.4.0.mysql 12 May 2006 08:50:22 -0000 1.3
+++ database/database.4.0.mysql 26 May 2006 03:05:09 -0000
@@ -537,6 +537,7 @@
CREATE TABLE poll_votes (
nid int(10) unsigned NOT NULL,
uid int(10) unsigned NOT NULL default 0,
+ chorder int(10) NOT NULL default -1,
hostname varchar(128) NOT NULL default '',
INDEX (nid),
INDEX (uid),
Index: database/database.4.1.mysql
===================================================================
RCS file: /cvs/drupal/drupal/database/database.4.1.mysql,v
retrieving revision 1.3
diff -u -F^f -r1.3 database.4.1.mysql
--- database/database.4.1.mysql 12 May 2006 08:50:22 -0000 1.3
+++ database/database.4.1.mysql 26 May 2006 03:05:10 -0000
@@ -573,6 +573,7 @@
CREATE TABLE poll_votes (
nid int(10) unsigned NOT NULL,
uid int(10) unsigned NOT NULL default 0,
+ chorder int(10) NOT NULL default -1,
hostname varchar(128) NOT NULL default '',
INDEX (nid),
INDEX (uid),
Index: database/database.pgsql
===================================================================
RCS file: /cvs/drupal/drupal/database/database.pgsql,v
retrieving revision 1.176
diff -u -F^f -r1.176 database.pgsql
--- database/database.pgsql 23 May 2006 19:03:50 -0000 1.176
+++ database/database.pgsql 26 May 2006 03:05:11 -0000
@@ -540,6 +540,7 @@
CREATE TABLE poll_votes (
nid int NOT NULL,
uid int NOT NULL default 0,
+ chorder int NOT NULL default -1,
hostname varchar(128) NOT NULL default ''
);
CREATE INDEX poll_votes_nid_idx ON poll_votes (nid);
Index: database/updates.inc
===================================================================
RCS file: /cvs/drupal/drupal/database/updates.inc,v
retrieving revision 1.231
diff -u -F^f -r1.231 updates.inc
--- database/updates.inc 23 May 2006 19:03:50 -0000 1.231
+++ database/updates.inc 26 May 2006 03:05:13 -0000
@@ -2014,3 +2014,23 @@ function system_update_182() {

return $ret;
}
+
+function system_update_184() {
+ // change DB schema for better poll support
+ $ret = array();
+
+ switch ($GLOBALS['db_type']) {
+ case 'mysqli':
+ case 'mysql':
+ // alter poll_votes table
+ $ret[] = update_sql("ALTER TABLE {poll_votes} ADD COLUMN chorder int(10) NOT NULL default -1 AFTER uid");
+ break;
+
+ case 'pgsql':
+ db_add_column($ret, 'poll_votes', 'chorder', 'int', array('not null' => TRUE, 'default' => "'-1'"));
+ break;
+ }
+
+ return $ret;
+}
+

so...how to use it....with al +,@,,== and al those symbols...