Enhanced Survey Block wont give random poll

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,430
   
Well... icon_rolleyes.gif




_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#2   re: Enhanced Survey Block wont give random poll
Camber
CZ Newbie
 Codezwiz Site Donator
Camber has been a member for over 18 year's 18 Year Member
Gender: Male
Status: Offline
Joined: May 01, 2006
0.00 posts per day
Posts: 11
Points: 2,135
   
I was wondering if this was ever resolved. I tried the Enhanced Survey block but I have two problems:

1. It does not show random surveys it stays on the last survey posted.
2. Users can only vote once, there is no expiration to the time limit that would allow a user to vote a second time.

I have another block that does show random polls that uses an entirely different method for generating the random. There are other problems with that block however and it doesn't show the results in line like the CZ version.

Any help would be greatly appreciated.



Back to top Reply with quote
#3   
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,430
   
Did you open the block file and edit the variables at the top so it would be random?

Can you verify if your table nuke_poll_desc primary key is poll_id?

The poll purge is controlled in your Surveys module in the function pollCollector.




_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#4   
Camber
CZ Newbie
 Codezwiz Site Donator
Camber has been a member for over 18 year's 18 Year Member
Gender: Male
Status: Offline
Joined: May 01, 2006
0.00 posts per day
Posts: 11
Points: 2,135
   
Thank you for the speedy reply!



Originally posted by Telli @ Fri Nov 06, 2009 2:12 am:

Did you open the block file and edit the variables at the top so it would be random?

Yes. The settings are:
$make_random = 1 
$number_of_days = 1




Originally posted by Telli @ Fri Nov 06, 2009 2:12 am:

Can you verify if your table nuke_poll_desc primary key is poll_id?

Primary key is pollID



Originally posted by Telli @ Fri Nov 06, 2009 2:12 am:

The poll purge is controlled in your Surveys module in the function pollCollector.


What does this line in the block do?

$number_of_days = 1; //Number of days in between voting per user.


A block that randomizes beautifully but lacks the inline results and has some other problems besides use this code for selecting a random survey:

mt_srand((double)microtime()*1000000);
$recordnr = mt_rand(1,$numrows)-1;
$pollID = $xpollid[$recordnr];
$pollTitle = $xpollTitle[$recordnr];
$voters = $xvoters[$recordnr];
$blockfiletitle = _SURVEY;
if ($pollID == 0 || $pollID == "") {
   $content = "";
   }


Thanks for digging into this one again.


Back to top Reply with quote
#5   
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,430
   
Do you have some type of cache system that caches the blocks?

Try running this query several times in Mysql and see if it returns a random result.


SELECT pollID, pollTitle, voters FROM nuke_poll_desc WHERE artid = 0 ORDER BY RAND() LIMIT 1




_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#6   re: Enhanced Survey Block wont give random poll
Camber
CZ Newbie
 Codezwiz Site Donator
Camber has been a member for over 18 year's 18 Year Member
Gender: Male
Status: Offline
Joined: May 01, 2006
0.00 posts per day
Posts: 11
Points: 2,135
   
I ran this line in the mysql a dozen times and it did produce a random result. I'm not using a cache on the site. It's very puzzling as to why this block isn't loading random surveys.



Back to top Reply with quote
#7   re: Enhanced Survey Block wont give random poll
ispgeek
CZ Newbie
 Codezwiz Site Donator
ispgeek has been a member for over 17 year's 17 Year Member
Gender: Male
Status: Offline
Joined: Nov 12, 2006
0.00 posts per day
Posts: 15
Points: 350
   
For what it's worth I'm also having the same problems with it not displaying random polls. Not sure if he told you what version of nuke he's using but in my case its 7.9 (i know i know i know )



Back to top Reply with quote
#8   re: Enhanced Survey Block wont give random poll
ispgeek
CZ Newbie
 Codezwiz Site Donator
ispgeek has been a member for over 17 year's 17 Year Member
Gender: Male
Status: Offline
Joined: Nov 12, 2006
0.00 posts per day
Posts: 15
Points: 350
   
While we're on the topic of survey blocks. Is there any way I could use the old stock block and change the config to select the poll id I want. That would actually be more useful to me because then I can just clone the block and change the poll id and place it on the page that I want instead of always having just the latest poll. I use blocks management which allows me to specify which block on which page so ideally I want to have different surveys for different pages. Ideas anyone?



Back to top Reply with quote
#9   
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,430
   
@Camber

Something is caching the results. You can change the query so it pulls all the polls into an array and then use that chuck of code you posted to pull a random poll.

@ispgeek

You can change the block query to this:


$result = $db->sql_query("SELECT pollID, pollTitle, voters FROM ".$prefix."_poll_desc $querylang AND pollID = $mypollID");


And above the query just add:


$mypollID = 1;




_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#10   re: Enhanced Survey Block wont give random poll
ispgeek
CZ Newbie
 Codezwiz Site Donator
ispgeek has been a member for over 17 year's 17 Year Member
Gender: Male
Status: Offline
Joined: Nov 12, 2006
0.00 posts per day
Posts: 15
Points: 350
   
Hey thanks alot. The only other feedback I have on the enhanced version is it would be nice to have it display the actual percentage.



Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum