serendipity_plugin_pollbox

Found a bug? Tell us!!
Post Reply
uptoome
Regular
Posts: 13
Joined: Sun Aug 07, 2005 6:18 am

serendipity_plugin_pollbox

Post by uptoome »

I added the Poll plugin, and created a poll with 'yes' and 'no' as choices. I did a test, selecting the 'no' option. The page was refreshed but both the 'yes' and 'no' percentages and vote counts were displayed as 0% and 0, respectively. I had to refresh the page to see the correct numbers. Is refreshing really required?

browser = firefox 1.0.4

hmmm... after refreshing the page, I now have a total vote count of 2, but yes votes -> 0 and no votes -> 1
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: serendipity_plugin_pollbox

Post by garvinhicking »

Which version of the poll plugin and which serendipity version are you using? Are you using both the event and the sidebar plugin, or only the sidebar plugin?

A URL to your site would also be helpful.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
uptoome
Regular
Posts: 13
Joined: Sun Aug 07, 2005 6:18 am

Post by uptoome »

Polls ver -> 2.05
Serendipity ver -> 0.9
Sidebar only
http://www.iamsickandtiredof.com
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Try to install the event plugin as well, I think this should help

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
uptoome
Regular
Posts: 13
Joined: Sun Aug 07, 2005 6:18 am

Post by uptoome »

Both plugins (ver 2.05) are now installed. I cast another 'no' vote. The page was refreshed and the %, totals were displayed. There were 3 no votes, 0 yes votes. The total votes was shown as 4.

Here are the contents of the serendipity_polls and serendipity_polls_options tables;

mysql> select * from serendipity_polls_options;
+----+--------+-------+-------+-----------+
| id | pollid | title | votes | timestamp |
+----+--------+-------+-------+-----------+
| 9 | 4 | Yes | 0 | NULL |
| 10 | 4 | No | 4 | NULL |
+----+--------+-------+-------+-----------+
2 rows in set (0.00 sec)

mysql> select * from serendipity_polls;
+----+-------------------------------------------------------------------------------------+---------+--------+-------+------------+
| id | title | content | active | votes | timestamp |
+----+-------------------------------------------------------------------------------------+---------+--------+-------+------------+
| 4 | Are you satisfied with the job your elected Senators and Representatives are doing? | NULL | 1 | 5 | 1133251683 |
+----+-------------------------------------------------------------------------------------+---------+--------+-------+------------+
1 row in set (0.00 sec)
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hm, but the SQL data says there were 4 votes? Can you start with a fresh voting, now that you have both plugins installed?

(I'm sorry, I rarely use that plugin)

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
uptoome
Regular
Posts: 13
Joined: Sun Aug 07, 2005 6:18 am

Post by uptoome »

The polls and polls_options tables get out-of-synch when the Go! button is clicked, but no choice has been selected. The polls.votes column is incremented; the polls_options columns aren't.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

I have noted that down and will look at it somewhen this week, thanks for giving me a pointer!

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
uptoome
Regular
Posts: 13
Joined: Sun Aug 07, 2005 6:18 am

Post by uptoome »

How about this change in showPoll() ?

Code: Select all


function showPoll($pollid = null) {
        global $serendipity;

        echo '<strong>' . $this->poll['title'] . '</strong>';
        echo '<form action="' . serendipity_currentURL() . '" method="post">';

        if ($pollid || $_SESSION["pollHasVoted{$this->poll['id']}"] || $serendipity['COOKIE']["p
ollHasVoted{$this->poll['id']}"]) {
            $this->showResults();
        } elseif (isset($serendipity['POST']['goVote'])) {
            $_SESSION["pollHasVoted{$this->poll['id']}"] = true;
            $this->setCookie("pollHasVoted{$this->poll['id']}", 'true');
// ---- bgn ----
            if ( isset($serendipity['POST']['vote']) ) {
                $this->addVote($this->poll['id'], $serendipity['POST']['vote']);
                $this->showResults();
            } else {
                $this->showOptions();
            }
// ---- end ----
        } else {
            $this->showOptions();
        }
        echo '</form>';
    }

[/code]
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Actually, that's nearly perfect. I just committed the change!

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply